Plugin Directory


Ignore:
Location:
forminator
Files:
2217 added
1 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • forminator/trunk/addons/pro/hubspot/class-forminator-addon-hubspot.php

    r3028842 r3047085  
    5858
    5959        $this->global_id_for_new_integrations = uniqid( '', true );
    60 
    61         add_filter(
    62             'forminator_addon_hubspot_api_request_headers',
    63             array(
    64                 $this,
    65                 'default_filter_api_headers',
    66             ),
    67             1,
    68             4
    69         );
    7060        add_action( 'wp_ajax_forminator_hubspot_support_request', array( $this, 'hubspot_support_request' ) );
    7161
     
    512502                $args          = array(
    513503                    'code'         => $code,
    514                     'redirect_uri' => $redirect_uri,
     504                    'redirect_uri' => rawurlencode( $redirect_uri ),
    515505                    'state'        => rawurlencode( self::get_nonce_value() . '|' . $final_redirect_url ),
    516506                );
     
    591581
    592582        return $values;
    593     }
    594 
    595     /**
    596      * Default filter for header
    597      *
    598      * its add / change Authorization header
    599      * - on get access token it uses Basic realm of encoded client id and secret
    600      * - on web API request it uses Bearer realm of access token which default of @see Forminator_Addon_Hubspot_Wp_Api
    601      *
    602      * @since 1.0 HubSpot Addon
    603      *
    604      * @param $headers
    605      * @param $verb
    606      * @param $path
    607      * @param $args
    608      *
    609      * @return array
    610      */
    611     public function default_filter_api_headers( $headers, $verb, $path, $args ) {
    612         if ( false !== stripos( $path, 'oauth.access' ) ) {
    613             $encoded_auth             = base64_encode( Forminator_Addon_Hubspot_Wp_Api::CLIENT_ID . ':' . Forminator_Addon_Hubspot_Wp_Api::CLIENT_SECRET ); //phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
    614             $headers['Authorization'] = 'Basic ' . $encoded_auth;
    615             unset( $headers['Content-Type'] );
    616         }
    617 
    618         return $headers;
    619583    }
    620584
  • forminator/trunk/addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php

    r3028842 r3047085  
    1111    const AUTHORIZE_URL = 'https://app.hubspot.com/oauth/authorize';
    1212    const CLIENT_ID     = 'd4c00215-5579-414c-a831-95be7218239b';
    13     const CLIENT_SECRET = '502c3a75-38fe-4a1f-9fc4-ff2464b639bf';
    14     const HAPIKEY       = '7cf97e44-4037-4708-a032-0955318e0e76';
    1513
    1614    public static $oauth_scopes = 'tickets crm.lists.write crm.lists.read crm.objects.contacts.write crm.objects.contacts.read crm.schemas.contacts.write crm.schemas.contacts.read';
     
    172170        $this->_last_url_request = $url;
    173171
    174         $headers = array(
    175             'Authorization' => 'Bearer ' . ( ! empty( $access_token ) ? $access_token : self::HAPIKEY ),
    176         );
     172        $headers = array();
     173        if ( $access_token ) {
     174            $headers = array(
     175                'Authorization' => 'Bearer ' . $access_token,
     176            );
     177        }
    177178
    178179        if ( 'GET' !== $verb && ! $json ) {
     
    385386        $response = $this->get_access_token( $args );
    386387
    387         if ( ! is_wp_error( $response ) && ! empty( $response->access_token ) ) {
     388        if ( ! empty( $response->access_token ) ) {
    388389            return $response->access_token;
    389390        }
     
    442443    public function get_access_token( $args = array() ) {
    443444        $default_args = array(
    444             'grant_type'    => 'authorization_code',
    445             'client_id'     => self::CLIENT_ID,
    446             'client_secret' => self::CLIENT_SECRET,
    447             'scope'         => rawurlencode( self::$oauth_scopes ),
     445            'grant_type' => 'authorization_code',
     446            'state'      => 'state', // It's added just because state param is required on the final endpoint. It's unuseful here.
    448447        );
    449448        $args         = array_merge( $default_args, $args );
    450449
    451         $response = $this->request(
    452             'POST',
    453             'oauth/v1/token',
    454             $args,
    455             ''
     450        $url = Forminator_Addon_Hubspot::redirect_uri(
     451            'hubspot',
     452            'get_access_token',
     453            $args
    456454        );
    457         if ( ! is_wp_error( $response ) && ! empty( $response->refresh_token ) ) {
     455
     456        $res      = wp_remote_get( $url );
     457        $body     = is_wp_error( $res ) || ! $res ? '' : wp_remote_retrieve_body( $res );
     458        $response = $body ? json_decode( $body ) : '';
     459        if ( ! empty( $response->refresh_token ) ) {
    458460            $token_data = get_object_vars( $response );
    459461
     
    462464            // Update auth token.
    463465            $this->update_auth_token( $token_data );
     466        } elseif ( isset( $response->error ) ) {
     467            if ( 'failed_request' === $response->error ) {
     468                $error = esc_html__( 'Failed to process request, make sure your API URL is correct and your server has internet connection.', 'forminator' );
     469            } else {
     470                $error = sprintf( esc_html__( 'Failed to process request : %s', 'forminator' ), esc_html( $response->error ) );
     471            }
     472
     473            throw new Forminator_Addon_Hubspot_Wp_Api_Exception( $error );
    464474        }
    465475
  • forminator/trunk/assets/js/front/front.multifile.js

    r3028842 r3047085  
    326326             */
    327327
    328             var name = '<p class="forminator-uploaded-file--title">' + filename + '</p>';
     328            var name = '<p class="forminator-uploaded-file--title">' + filename.replace( /[<>:"/\\|?*]+/g, '_' ) + '</p>';
    329329
    330330            /**
  • forminator/trunk/assets/js/front/front.submit.js

    r3028842 r3047085  
    568568                    .closest('.forminator-row, .forminator-col').hasClass('forminator-hidden');
    569569                if ( self.$el.data('forminatorFrontPayment') && ! paymentIsHidden && ! $saveDraft ) {
    570                     self.$el.trigger('payment.before.submit.forminator', [formData, function () {
    571                         submitCallback.apply(thisForm);
    572                     }]);
     570                    setTimeout( function() {
     571                        self.$el.trigger('payment.before.submit.forminator', [formData, function () {
     572                            submitCallback.apply(thisForm);
     573                        }]);
     574                    }, 200 );
    573575                } else {
    574576                    submitCallback.apply(thisForm);
  • forminator/trunk/build/admin/scgen.min.js

    r3028842 r3047085  
    1 !function(t){"use strict";t(function(){n.init()});var n={init:function(){t("body").addClass("sui-forminator-scgen "+forminatorScgenData.suiVersion),SUI.suiTabs(),this.init_select(),t("#forminator-scgen-modal").show(),t(document).on("click","#forminator-generate-shortcode",this.open_modal),t(document).on("click",".sui-dialog .sui-dialog-close",this.close_modal),t(document).on("click",".sui-dialog-overlay",this.close_modal),t(document).on("click",".wpmudev-insert-cform",this.insert_form),t(document).on("click",".wpmudev-insert-poll",this.insert_poll),t(document).on("click",".wpmudev-insert-quiz",this.insert_quiz)},init_select:function(){setTimeout(function(){SUI.select.init(t("#forminator-scgen-modal .sui-select"))},10)},open_modal:function(o){SUI.openModal("forminator-popup",o.target,void 0,!1,!0)},close_modal:function(){SUI.closeModal(),setTimeout(function(){t("#forminator-popup").find(".sui-tabs .sui-form-field").removeClass("sui-form-field-error"),t("#forminator-popup").find(".sui-tabs .sui-form-field .sui-error-message").hide()},1e3)},insert_form:function(o){var i=t(this),s=i.closest(".fui-simulate-footer").parent("div").find(".sui-form-field"),e=i.closest(".sui-tabs").find(".sui-form-field"),r=t(".forminator-custom-form-list").val();i.addClass("sui-button-onload"),setTimeout(function(){i.removeClass("sui-button-onload"),r?(e.removeClass("sui-form-field-error"),e.find(".sui-error-message").hide(),n.insert_shortcode("forminator_form",r)):(s.addClass("sui-form-field-error"),s.find(".sui-error-message").show())},500),o.preventDefault(),o.stopPropagation()},insert_poll:function(o){var i=t(this),s=i.closest(".fui-simulate-footer").parent("div").find(".sui-form-field"),e=i.closest(".sui-tabs").find(".sui-form-field"),r=t(".forminator-insert-poll").val();i.addClass("sui-button-onload"),setTimeout(function(){i.removeClass("sui-button-onload"),r?(e.removeClass("sui-form-field-error"),e.find(".sui-error-message").hide(),n.insert_shortcode("forminator_poll",r)):(s.addClass("sui-form-field-error"),s.find(".sui-error-message").show())},500),o.preventDefault(),o.stopPropagation()},insert_quiz:function(o){var i=t(this),s=i.closest(".fui-simulate-footer").parent("div").find(".sui-form-field"),e=i.closest(".sui-tabs").find(".sui-form-field"),r=t(".forminator-quiz-list").val();i.addClass("sui-button-onload"),setTimeout(function(){i.removeClass("sui-button-onload"),r?(e.removeClass("sui-form-field-error"),e.find(".sui-error-message").hide(),n.insert_shortcode("forminator_quiz",r)):(s.addClass("sui-form-field-error"),s.find(".sui-error-message").show())},500),o.preventDefault(),o.stopPropagation()},insert_shortcode:function(o,i){window.parent.send_to_editor("["+o+' id="'+i+'"]'),SUI.closeModal()}}}(jQuery,document);
     1(function ($, doc) {
     2    "use strict";
     3
     4    (function () {
     5        $(function () {
     6            Forminator_Shortcode_Generator.init();
     7        });
     8
     9    }());
     10
     11    var Forminator_Shortcode_Generator = {
     12
     13        init: function () {
     14
     15            // Add proper class to body
     16            $( 'body' ).addClass( 'sui-forminator-scgen ' + forminatorScgenData.suiVersion );
     17
     18            // Init tabs
     19            SUI.suiTabs();
     20
     21            // Init SUI Select2.
     22            this.init_select();
     23
     24            // Load modal
     25            $( '#forminator-scgen-modal' ).show();
     26
     27            // Handle modal open click
     28            $(document).on("click", "#forminator-generate-shortcode", this.open_modal );
     29
     30            // Handle modal close click
     31            $(document).on("click", ".sui-dialog .sui-dialog-close", this.close_modal );
     32            $(document).on("click", ".sui-dialog-overlay", this.close_modal);
     33
     34            // Handle modal custom form insert
     35            $(document).on("click", ".wpmudev-insert-cform", this.insert_form );
     36
     37            // Handle modal poll insert
     38            $(document).on("click", ".wpmudev-insert-poll", this.insert_poll );
     39
     40            // Handle modal quiz insert
     41            $(document).on("click", ".wpmudev-insert-quiz", this.insert_quiz );
     42        },
     43
     44        init_select: function () {
     45
     46            setTimeout( function(){
     47                SUI.select.init( $( '#forminator-scgen-modal .sui-select' ) );
     48            }, 10 );
     49        },
     50
     51        open_modal: function( e ) {
     52
     53            SUI.openModal(
     54                'forminator-popup',
     55                e.target,
     56                undefined,
     57                false,
     58                true
     59            );
     60        },
     61
     62        close_modal: function() {
     63
     64            // Close dialog
     65            SUI.closeModal();
     66
     67            setTimeout( function() {
     68
     69                // Hide error on fields
     70                $( '#forminator-popup' ).find( '.sui-tabs .sui-form-field' ).removeClass( 'sui-form-field-error' );
     71                $( '#forminator-popup' ).find( '.sui-tabs .sui-form-field .sui-error-message' ).hide();
     72            }, 1000 );
     73        },
     74
     75        insert_form: function( e ) {
     76
     77            var button   = $( this ),
     78                curTab   = button.closest( '.fui-simulate-footer' ).parent( 'div' ),
     79                curForm  = curTab.find( '.sui-form-field' ),
     80                allForms = button.closest( '.sui-tabs' ).find( '.sui-form-field' ),
     81                moduleId = $( '.forminator-custom-form-list' ).val()
     82                ;
     83
     84            button.addClass( 'sui-button-onload' );
     85
     86            setTimeout( function() {
     87
     88                button.removeClass( 'sui-button-onload' );
     89
     90                if ( moduleId ) {
     91                    allForms.removeClass( 'sui-form-field-error' );
     92                    allForms.find( '.sui-error-message' ).hide();
     93                    Forminator_Shortcode_Generator.insert_shortcode( 'forminator_form', moduleId );
     94                } else {
     95                    curForm.addClass( 'sui-form-field-error' );
     96                    curForm.find( '.sui-error-message' ).show();
     97                }
     98
     99            }, 500 );
     100
     101            e.preventDefault();
     102            e.stopPropagation();
     103
     104        },
     105
     106        insert_poll: function( e ) {
     107
     108            var button   = $( this ),
     109                curTab   = button.closest( '.fui-simulate-footer' ).parent( 'div' ),
     110                curForm  = curTab.find( '.sui-form-field' ),
     111                allForms = button.closest( '.sui-tabs' ).find( '.sui-form-field' ),
     112                moduleId = $( '.forminator-insert-poll' ).val()
     113                ;
     114
     115            button.addClass( 'sui-button-onload' );
     116
     117            setTimeout( function() {
     118
     119                button.removeClass( 'sui-button-onload' );
     120
     121                if ( moduleId ) {
     122                    allForms.removeClass( 'sui-form-field-error' );
     123                    allForms.find( '.sui-error-message' ).hide();
     124                    Forminator_Shortcode_Generator.insert_shortcode( 'forminator_poll', moduleId );
     125                } else {
     126                    curForm.addClass( 'sui-form-field-error' );
     127                    curForm.find( '.sui-error-message' ).show();
     128                }
     129
     130            }, 500 );
     131
     132            e.preventDefault();
     133            e.stopPropagation();
     134
     135        },
     136
     137        insert_quiz: function( e ) {
     138
     139            var button   = $( this ),
     140                curTab   = button.closest( '.fui-simulate-footer' ).parent( 'div' ),
     141                curForm  = curTab.find( '.sui-form-field' ),
     142                allForms = button.closest( '.sui-tabs' ).find( '.sui-form-field' ),
     143                moduleId = $( '.forminator-quiz-list' ).val()
     144                ;
     145
     146            button.addClass( 'sui-button-onload' );
     147
     148            setTimeout( function() {
     149
     150                button.removeClass( 'sui-button-onload' );
     151
     152                if ( moduleId ) {
     153                    allForms.removeClass( 'sui-form-field-error' );
     154                    allForms.find( '.sui-error-message' ).hide();
     155                    Forminator_Shortcode_Generator.insert_shortcode( 'forminator_quiz', moduleId );
     156                } else {
     157                    curForm.addClass( 'sui-form-field-error' );
     158                    curForm.find( '.sui-error-message' ).show();
     159                }
     160
     161            }, 500 );
     162
     163            e.preventDefault();
     164            e.stopPropagation();
     165
     166        },
     167
     168        insert_shortcode: function (module, id) {
     169
     170            var shortcode = '[' + module + ' id="' + id + '"]';
     171            window.parent.send_to_editor( shortcode );
     172
     173            SUI.closeModal();
     174        }
     175    };
     176}(jQuery, document));
  • forminator/trunk/build/front/front.multi.min.js

    r3028842 r3047085  
    1 !function n(o,i,a){function s(e,t){if(!i[e]){if(!o[e]){var r="function"==typeof require&&require;if(!t&&r)return r(e,!0);if(l)return l(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}r=i[e]={exports:{}},o[e][0].call(r.exports,function(t){return s(o[e][1][t]||t)},r,r.exports,n,o,i,a)}return i[e].exports}for(var l="function"==typeof require&&require,t=0;t<a.length;t++)s(a[t]);return s}({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=n(t("./parser/front.calculator.parser.tokenizer")),i=n(t("./symbol/front.calculator.symbol.loader")),a=n(t("./parser/front.calculator.parser")),s=n(t("./symbol/front.calculator.symbol.number")),l=n(t("./symbol/abstract/front.calculator.symbol.constant.abstract")),f=n(t("./parser/node/front.calculator.parser.node.symbol")),u=n(t("./symbol/abstract/front.calculator.symbol.operator.abstract")),c=n(t("./symbol/front.calculator.symbol.separator")),m=n(t("./parser/node/front.calculator.parser.node.function")),d=n(t("./parser/node/front.calculator.parser.node.container"));function n(t){return t&&t.__esModule?t:{default:t}}function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==h(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===h(t)?t:String(t)}(n.key),n)}}var b=r.default=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.term=t,this.tokenizer=new o.default(this.term),this.symbolLoader=new i.default,this.parser=new a.default(this.symbolLoader)}var t,r,n;return t=e,(r=[{key:"parse",value:function(){this.tokenizer.input=this.term,this.tokenizer.reset();var t=this.tokenizer.tokenize();if(0===t.length)throw"Error: Empty token of calculator term.";t=this.parser.parse(t);if(t.isEmpty())throw"Error: Empty nodes of calculator tokens.";return t}},{key:"calculate",value:function(){var t=this.parse();return!1===t?0:this.calculateNode(t)}},{key:"calculateNode",value:function(t){if(t instanceof f.default)return this.calculateSymbolNode(t);if(t instanceof m.default)return this.calculateFunctionNode(t);if(t instanceof d.default)return this.calculateContainerNode(t);throw'Error: Cannot calculate node of unknown type "'+t.constructor.name+'"'}},{key:"calculateContainerNode",value:function(t){if(t instanceof m.default)throw"Error: Expected container node but got a function node";for(var e=0,r=t.childNodes,n=this.detectCalculationOrder(r),o=0;o<n.length;o++){for(var i=n[o].node,a=n[o].index,s=null,l=null,f=0;f!==a;)void 0===r[f]||(s=r[f],l=f),f++;for(f++;void 0===r[f];)f++;var u=r[f],c=f,u=isNaN(u)?this.calculateNode(u):u,d=i.symbol;i.isUnaryOperator?(e=d.operate(null,u),delete r[c],r[a]=e):null!==l&&null!==s&&(i=isNaN(s)?this.calculateNode(s):s,e=d.operate(i,u),delete r[l],delete r[c],r[a]=e)}if(0===(r=r.filter(function(t){return void 0!==t})).length)throw"Error: Missing calculable subterm. Are there empty brackets?";if(1<r.length)throw"Error: Missing operators between parts of the term.";return e=r.pop(),isNaN(e)?this.calculateNode(e):e}},{key:"calculateFunctionNode",value:function(t){for(var e=t.childNodes,r=[],n=[],o=null,i=0;i<e.length;i++){var a=e[i];a instanceof f.default&&a.symbol instanceof c.default?(o=new d.default(n),r.push(this.calculateNode(o)),n=[]):n.push(a)}return 0<n.length&&(o=new d.default(n),r.push(this.calculateNode(o))),t.symbolNode.symbol.execute(r)}},{key:"calculateSymbolNode",value:function(t){var e=t.symbol,r=0;if(e instanceof s.default)r=t.token.value,r=Number(r);else{if(!(e instanceof l.default))throw'Error: Found symbol of unexpected type "'+e.constructor.name+'", expected number or constant';r=e.value}return r}},{key:"detectCalculationOrder",value:function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];n instanceof f.default&&n.symbol instanceof u.default&&e.push({index:r,node:n})}return e.sort(function(t,e){var t=t.node,e=e.node,r=t.symbol,n=2,o=(t.isUnaryOperator&&(n=3),e.symbol),i=2;return n===(i=e.isUnaryOperator?3:i)&&(n=r.precedence,i=o.precedence),n===i?t.token.position<e.token.position?-1:1:n<i?1:-1}),e}}])&&p(t.prototype,r),n&&p(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();void 0===window.forminatorCalculator&&(window.forminatorCalculator=function(t){return new b(t)})},{"./parser/front.calculator.parser":2,"./parser/front.calculator.parser.tokenizer":4,"./parser/node/front.calculator.parser.node.container":6,"./parser/node/front.calculator.parser.node.function":7,"./parser/node/front.calculator.parser.node.symbol":8,"./symbol/abstract/front.calculator.symbol.constant.abstract":10,"./symbol/abstract/front.calculator.symbol.operator.abstract":12,"./symbol/front.calculator.symbol.loader":16,"./symbol/front.calculator.symbol.number":17,"./symbol/front.calculator.symbol.separator":18}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var f=n(t("./front.calculator.parser.token")),u=n(t("../symbol/front.calculator.symbol.number")),c=n(t("../symbol/brackets/front.calculator.symbol.opening.bracket")),d=n(t("../symbol/brackets/front.calculator.symbol.closing.bracket")),m=n(t("../symbol/abstract/front.calculator.symbol.function.abstract")),a=n(t("../symbol/abstract/front.calculator.symbol.operator.abstract")),s=n(t("../symbol/front.calculator.symbol.separator")),h=n(t("./node/front.calculator.parser.node.symbol")),l=n(t("./node/front.calculator.parser.node.container")),p=n(t("./node/front.calculator.parser.node.function"));function n(t){return t&&t.__esModule?t:{default:t}}function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}r.default=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.symbolLoader=t}var t,r,n;return t=e,(r=[{key:"parse",value:function(t){t=this.detectSymbols(t),t=this.createTreeByBrackets(t),t=this.transformTreeByFunctions(t);return this.checkGrammar(t),new l.default(t)}},{key:"detectSymbols",value:function(t){for(var e=[],r=null,n=null,o=!1,i=0,a=0;a<t.length;a++){var s=t[a],l=s.type;if(f.default.TYPE_WORD===l){if(n=s.value,null===(r=this.symbolLoader.find(n)))throw"Error: Detected unknown or invalid string identifier: "+n+"."}else if(l===f.default.TYPE_NUMBER){l=this.symbolLoader.findSubTypes(u.default);if(l.length<1||!(l instanceof Array))throw"Error: Unavailable number symbol processor.";r=l[0]}else{if(n=s.value,null===(r=this.symbolLoader.find(n)))throw"Error: Detected unknown or invalid string identifier: "+n+".";if(r instanceof c.default&&i++,r instanceof d.default&&--i<0)throw"Error: Found closing bracket that does not have an opening bracket."}if(o){if(!(r instanceof c.default))throw"Error: Expected opening bracket (after a function) but got something else.";o=!1}else r instanceof m.default&&(o=!0);l=new h.default(s,r);e.push(l)}if(o)throw"Error: Expected opening bracket (after a function) but reached the end of the term";if(0<i)throw"Error: There is at least one opening bracket that does not have a closing bracket";return e}},{key:"createTreeByBrackets",value:function(t){for(var e=[],r=[],n=0,o=0;o<t.length;o++){var i,a=t[o];if(!(a instanceof h.default))throw'Error: Expected symbol node, but got "'+a.constructor.name+'"';a.symbol instanceof c.default?1<++n&&r.push(a):a.symbol instanceof d.default?0===--n?(i=this.createTreeByBrackets(r),e.push(new l.default(i)),r=[]):r.push(a):(0===n?e:r).push(a)}return e}},{key:"transformTreeByFunctions",value:function(t){for(var e=[],r=null,n=0;n<t.length;n++){var o=t[n];if(o instanceof l.default){var i,a=this.transformTreeByFunctions(o.childNodes);null!==r?(i=new p.default(a,r),e.push(i),r=null):(o.childNodes=a,e.push(o))}else{if(!(o instanceof h.default))throw'Error: Expected array node or symbol node, got "'+o.constructor.name+'"';o.symbol instanceof m.default?r=o:e.push(o)}}return e}},{key:"checkGrammar",value:function(t){for(var e=0;e<t.length;e++){var r=t[e];if(r instanceof h.default){var n=r.symbol;if(n instanceof a.default){if(e+1>=t.length)throw"Error: Found operator that does not stand before an operand.";var o=e-1,i=null;if(null===(i=0<=o&&(i=t[o])instanceof h.default&&(i.symbol instanceof a.default||i.symbol instanceof s.default)?null:i)){if(!n.operatesUnary)throw"Error: Found operator in unary notation that is not unary.";r.setIsUnaryOperator(!0)}else if(!n.operatesBinary)throw console.log(n),"Error: Found operator in binary notation that is not binary."}}else this.checkGrammar(r.childNodes)}}}])&&i(t.prototype,r),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{"../symbol/abstract/front.calculator.symbol.function.abstract":11,"../symbol/abstract/front.calculator.symbol.operator.abstract":12,"../symbol/brackets/front.calculator.symbol.closing.bracket":13,"../symbol/brackets/front.calculator.symbol.opening.bracket":14,"../symbol/front.calculator.symbol.number":17,"../symbol/front.calculator.symbol.separator":18,"./front.calculator.parser.token":3,"./node/front.calculator.parser.node.container":6,"./node/front.calculator.parser.node.function":7,"./node/front.calculator.parser.node.symbol":8}],3:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function n(t,e,r){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.type=t,this.value=e,this.position=r}var t,e,r;return t=n,r=[{key:"TYPE_WORD",get:function(){return 1}},{key:"TYPE_CHAR",get:function(){return 2}},{key:"TYPE_NUMBER",get:function(){return 3}}],(e=null)&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),n}()},{}],4:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=(t=t("./front.calculator.parser.token"))&&t.__esModule?t:{default:t};function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==i(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===i(t)?t:String(t)}(n.key),n)}}r.default=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.input=t,this.currentPosition=0}var t,r,n;return t=e,(r=[{key:"tokenize",value:function(){this.reset();for(var t=[],e=this.readToken();e;)t.push(e),e=this.readToken();return t}},{key:"readToken",value:function(){this.stepOverWhitespace();var t,e,r=this.readCurrent();return null===r?null:(e=t=null,e=this.isLetter(r)?(t=this.readWord(),o.default.TYPE_WORD):this.isDigit(r)||this.isPeriod(r)?(t=this.readNumber(),o.default.TYPE_NUMBER):(t=this.readChar(),o.default.TYPE_CHAR),new o.default(e,t,this.currentPosition))}},{key:"isLetter",value:function(t){return null!==t&&(65<=(t=t.charCodeAt(0))&&t<=90||97<=t&&t<=122)}},{key:"isDigit",value:function(t){return null!==t&&48<=(t=t.charCodeAt(0))&&t<=57}},{key:"isPeriod",value:function(t){return"."===t}},{key:"isWhitespace",value:function(t){return 0<=[" ","\t","\n"].indexOf(t)}},{key:"stepOverWhitespace",value:function(){for(;this.isWhitespace(this.readCurrent());)this.readNext()}},{key:"readWord",value:function(){for(var t="",e=this.readCurrent();null!==e&&this.isLetter(e);)t+=e,e=this.readNext();return t}},{key:"readNumber",value:function(){for(var t="",e=!1,r=this.readCurrent();null!==r&&(this.isPeriod(r)||this.isDigit(r));){if(this.isPeriod(r)){if(e)throw"Error: A number cannot have more than one period";e=!0}t+=r,r=this.readNext()}return t}},{key:"readChar",value:function(){var t=this.readCurrent();return this.readNext(),t}},{key:"readCurrent",value:function(){var t=null;return t=this.hasCurrent()?this.input[this.currentPosition]:t}},{key:"readNext",value:function(){return this.currentPosition++,this.readCurrent()}},{key:"hasCurrent",value:function(){return this.currentPosition<this.input.length}},{key:"reset",value:function(){this.currentPosition=0}}])&&a(t.prototype,r),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),e}()},{"./front.calculator.parser.token":3}],5:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function i(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=i(function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function")})},{}],6:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=(t=t("./front.calculator.parser.node.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=f(r),e=(t=n?(t=f(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n=l(o);function o(t){var e;if(this instanceof o)return(e=n.call(this)).childNodes=null,e.setChildNodes(t),e;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"setChildNodes",value:function(t){t.forEach(function(t){if(!(t instanceof i.default))throw"Expected AbstractNode, but got "+t.constructor.name}),this.childNodes=t}},{key:"size",value:function(){try{return this.childNodes.length}catch(t){return 0}}},{key:"isEmpty",value:function(){return!this.size()}}])&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(i.default)},{"./front.calculator.parser.node.abstract":5}],7:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./front.calculator.parser.node.container"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=i(r),e=(t=n?(t=i(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,o=l(i);function i(t,e){if(this instanceof i)return(t=o.call(this,t)).symbolNode=e,t;throw new TypeError("Cannot call a class as a function")}return e=i,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"./front.calculator.parser.node.container":6}],8:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=n(t("../../symbol/abstract/front.calculator.symbol.operator.abstract")),t=n(t("./front.calculator.parser.node.abstract"));function n(t){return t&&t.__esModule?t:{default:t}}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=f(r),e=(t=n?(t=f(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n=l(o);function o(t,e){var r;if(this instanceof o)return(r=n.call(this)).token=t,r.symbol=e,r.isUnaryOperator=!1,r;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"setIsUnaryOperator",value:function(t){if(!(this.symbol instanceof i.default))throw"Error: Cannot mark node as unary operator, because symbol is not an operator but of type "+this.symbol.constructor.name;this.isUnaryOperator=t}}])&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../../symbol/abstract/front.calculator.symbol.operator.abstract":12,"./front.calculator.parser.node.abstract":5}],9:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;r.default=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.identifiers=[]}var e,r,n;return e=t,(r=[{key:"getIdentifiers",value:function(){var e=[];return this.identifiers.forEach(function(t){e.push(t.toLowerCase())}),e}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},{}],10:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=i(r),e=(t=n?(t=i(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,o=l(i);function i(){var t;if(this instanceof i)return(t=o.call(this)).value=0,t;throw new TypeError("Cannot call a class as a function")}return e=i,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"./front.calculator.symbol.abstract":9}],11:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){if(this instanceof o)return n.call(this);throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"execute",value:function(t){return 0}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"./front.calculator.symbol.abstract":9}],12:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).precedence=0,t.operatesUnary=!1,t.operatesBinary=!0,t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"operate",value:function(t,e){return 0}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"./front.calculator.symbol.abstract":9}],13:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=i(r),e=(t=n?(t=i(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,o=l(i);function i(){var t;if(this instanceof i)return(t=o.call(this)).identifiers=[")"],t;throw new TypeError("Cannot call a class as a function")}return e=i,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"../abstract/front.calculator.symbol.abstract":9}],14:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=i(r),e=(t=n?(t=i(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,o=l(i);function i(){var t;if(this instanceof i)return(t=o.call(this)).identifiers=["("],t;throw new TypeError("Cannot call a class as a function")}return e=i,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"../abstract/front.calculator.symbol.abstract":9}],15:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.constant.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=i(r),e=(t=n?(t=i(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,o=l(i);function i(){var t;if(this instanceof i)return(t=o.call(this)).identifiers=["pi"],t.value=Math.PI,t;throw new TypeError("Cannot call a class as a function")}return e=i,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"../abstract/front.calculator.symbol.constant.abstract":10}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=n(t("./front.calculator.symbol.number")),i=n(t("./front.calculator.symbol.separator")),a=n(t("./brackets/front.calculator.symbol.opening.bracket")),s=n(t("./brackets/front.calculator.symbol.closing.bracket")),l=n(t("./constants/front.calculator.symbol.constant.pi")),f=n(t("./operators/front.calculator.symbol.operator.addition")),u=n(t("./operators/front.calculator.symbol.operator.division")),c=n(t("./operators/front.calculator.symbol.operator.exponentiation")),d=n(t("./operators/front.calculator.symbol.operator.modulo")),m=n(t("./operators/front.calculator.symbol.operator.multiplication")),h=n(t("./operators/front.calculator.symbol.operator.subtraction")),p=n(t("./functions/front.calculator.symbol.function.abs")),b=n(t("./functions/front.calculator.symbol.function.avg")),y=n(t("./functions/front.calculator.symbol.function.ceil")),g=n(t("./functions/front.calculator.symbol.function.floor")),v=n(t("./functions/front.calculator.symbol.function.max")),_=n(t("./functions/front.calculator.symbol.function.min")),w=n(t("./functions/front.calculator.symbol.function.round"));function n(t){return t&&t.__esModule?t:{default:t}}function O(t){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function C(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==O(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==O(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===O(t)?t:String(t)}(n.key),n)}}r.default=function(){function t(){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this.symbols={FrontCalculatorSymbolNumber:new o.default,FrontCalculatorSymbolSeparator:new i.default,FrontCalculatorSymbolOpeningBracket:new a.default,FrontCalculatorSymbolClosingBracket:new s.default,FrontCalculatorSymbolConstantPi:new l.default,FrontCalculatorSymbolOperatorAddition:new f.default,FrontCalculatorSymbolOperatorDivision:new u.default,FrontCalculatorSymbolOperatorExponentiation:new c.default,FrontCalculatorSymbolOperatorModulo:new d.default,FrontCalculatorSymbolOperatorMultiplication:new m.default,FrontCalculatorSymbolOperatorSubtraction:new h.default,FrontCalculatorSymbolFunctionAbs:new p.default,FrontCalculatorSymbolFunctionAvg:new b.default,FrontCalculatorSymbolFunctionCeil:new y.default,FrontCalculatorSymbolFunctionFloor:new g.default,FrontCalculatorSymbolFunctionMax:new v.default,FrontCalculatorSymbolFunctionMin:new _.default,FrontCalculatorSymbolFunctionRound:new w.default}}var e,r,n;return e=t,(r=[{key:"find",value:function(t){for(var e in t=t.toLowerCase(),this.symbols)if(this.symbols.hasOwnProperty(e)){e=this.symbols[e];if(0<=e.getIdentifiers().indexOf(t))return e}return null}},{key:"findSubTypes",value:function(t){var e,r,n=[];for(e in this.symbols)this.symbols.hasOwnProperty(e)&&(r=this.symbols[e])instanceof t&&n.push(r);return n}}])&&C(e.prototype,r),n&&C(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}()},{"./brackets/front.calculator.symbol.closing.bracket":13,"./brackets/front.calculator.symbol.opening.bracket":14,"./constants/front.calculator.symbol.constant.pi":15,"./front.calculator.symbol.number":17,"./front.calculator.symbol.separator":18,"./functions/front.calculator.symbol.function.abs":19,"./functions/front.calculator.symbol.function.avg":20,"./functions/front.calculator.symbol.function.ceil":21,"./functions/front.calculator.symbol.function.floor":22,"./functions/front.calculator.symbol.function.max":23,"./functions/front.calculator.symbol.function.min":24,"./functions/front.calculator.symbol.function.round":25,"./operators/front.calculator.symbol.operator.addition":26,"./operators/front.calculator.symbol.operator.division":27,"./operators/front.calculator.symbol.operator.exponentiation":28,"./operators/front.calculator.symbol.operator.modulo":29,"./operators/front.calculator.symbol.operator.multiplication":30,"./operators/front.calculator.symbol.operator.subtraction":31}],17:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./abstract/front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=i(r),e=(t=n?(t=i(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,o=l(i);function i(){if(this instanceof i)return o.call(this);throw new TypeError("Cannot call a class as a function")}return e=i,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"./abstract/front.calculator.symbol.abstract":9}],18:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("./abstract/front.calculator.symbol.abstract"))&&t.__esModule?t:{default:t};function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=i(r),e=(t=n?(t=i(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=i;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n,o=l(i);function i(){var t;if(this instanceof i)return(t=o.call(this)).identifiers=[","],t;throw new TypeError("Cannot call a class as a function")}return e=i,r&&a(e.prototype,r),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(t.default)},{"./abstract/front.calculator.symbol.abstract":9}],19:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["abs"],t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"execute",value:function(t){if(1!==t.length)throw"Error: Expected one argument, got "+t.length;t=t[0];return Math.abs(t)}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],20:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["avg"],t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"execute",value:function(t){if(t.length<1)throw"Error: Expected at least one argument, got "+t.length;for(var e=0,r=0;r<t.length;r++)e+=t[r];return e/t.length}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],21:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["ceil"],t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"execute",value:function(t){if(1!==t.length)throw"Error: Expected one argument, got "+t.length;return Math.ceil(t[0])}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],22:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["floor"],t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"execute",value:function(t){if(1!==t.length)throw"Error: Expected one argument, got "+t.length;return Math.floor(t[0])}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],23:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function i(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var r;if(t)return"string"==typeof t?n(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=f(r),e=(t=n?(t=f(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n=l(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["max"],t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"execute",value:function(t){if(t.length<1)throw"Error: Expected at least one argument, got "+t.length;return Math.max.apply(Math,i(t))}}])&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],24:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function i(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){var r;if(t)return"string"==typeof t?n(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function s(t,e){return(s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function l(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=f(r),e=(t=n?(t=f(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t);var r,n=l(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["min"],t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"execute",value:function(t){if(t.length<1)throw"Error: Expected at least one argument, got "+t.length;return Math.min.apply(Math,i(t))}}])&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],25:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.function.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["round"],t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"execute",value:function(t){if(1!==t.length)throw"Error: Expected one argument, got "+t.length;return Math.round(t[0])}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.function.abstract":11}],26:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["+"],t.precedence=100,t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"operate",value:function(t,e){return t+e}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],27:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["/"],t.precedence=200,t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"operate",value:function(t,e){return t/e}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],28:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["^"],t.precedence=300,t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"operate",value:function(t,e){return Math.pow(t,e)}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],29:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["%"],t.precedence=200,t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"operate",value:function(t,e){return t%e}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],30:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["*"],t.precedence=200,t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"operate",value:function(t,e){return t*e}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}],31:[function(t,e,r){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;t=(t=t("../abstract/front.calculator.symbol.operator.abstract"))&&t.__esModule?t:{default:t};function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,function(t){t=function(t,e){if("object"!==o(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0===r)return("string"===e?String:Number)(t);r=r.call(t,e||"default");if("object"!==o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(t,"string");return"symbol"===o(t)?t:String(t)}(n.key),n)}}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(r){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=l(r),e=(t=n?(t=l(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments),this);if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==e)return e;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}r.default=function(t){var e=o;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t);var r,n=s(o);function o(){var t;if(this instanceof o)return(t=n.call(this)).identifiers=["-"],t.precedence=100,t.operatesUnary=!0,t;throw new TypeError("Cannot call a class as a function")}return e=o,(t=[{key:"operate",value:function(t,e){return t-e}}])&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),o}(t.default)},{"../abstract/front.calculator.symbol.operator.abstract":12}]},{},[1]),[].includes||(Array.prototype.includes=function(t,e){"use strict";var r=Object(this),n=parseInt(r.length)||0;if(0!==n){var o,e=parseInt(e)||0;for(0<=e?o=e:(o=n+e)<0&&(o=0);o<n;){var i=r[o];if(t===i||t!=t&&i!=i)return!0;o++}}return!1});class forminatorFrontUtils{constructor(){}field_is_checkbox(t){var e=!1;return t.each(function(){if("checkbox"===jQuery(this).attr("type"))return!(e=!0)}),e}field_is_radio(t){var e=!1;return t.each(function(){if("radio"===jQuery(this).attr("type"))return!(e=!0)}),e}field_is_select(t){return t.is("select")}field_has_inputMask(t){var e=!1;return t.each(function(){if(void 0!==jQuery(this).attr("data-inputmask"))return!(e=!0)}),e}get_field_value(t){var e=0,r=0,n=null;return this.field_is_radio(t)?(n=t.filter(":checked")).length&&void 0!==(r=n.data("calculation"))&&(e=Number(r)):this.field_is_checkbox(t)?t.each(function(){jQuery(this).is(":checked")&&void 0!==(r=jQuery(this).data("calculation"))&&(e+=Number(r))}):this.field_is_select(t)?(n=t.find("option").filter(":selected")).length&&void 0!==(r=n.data("calculation"))&&(e=Number(r)):this.field_has_inputMask(t)?e=parseFloat(t.inputmask("unmaskedvalue").replace(",",".")):t.length&&(n=t.val(),e=parseFloat(n.replace(",","."))),isNaN(e)?0:e}}void 0===window.forminatorUtils&&(window.forminatorUtils=function(){return new forminatorFrontUtils}),function(l,f,a){"use strict";var r="forminatorLoader",n={action:"",type:"",id:"",render_id:"",is_preview:"",preview_data:[],nonce:!1,last_submit_data:{},extra:{}};function e(t,e){this.element=t,this.$el=l(this.element),this.settings=l.extend({},n,e),this._defaults=n,this._name=r,this.frontInitCalled=!1,this.scriptsQue=[],this.frontOptions=null,this.leadFrontOptions=null,this.init()}l.extend(e.prototype,{init:function(){var t=decodeURI(a.location.search).replace(/(^\?)/,"").split("&").map(function(t){return this[(t=t.split("="))[0]]=t[1],this}.bind({}))[0];t.action=this.settings.action,t.type=this.settings.type,t.id=this.settings.id,t.render_id=this.settings.render_id,t.is_preview=this.settings.is_preview,t.preview_data=JSON.stringify(this.settings.preview_data),t.last_submit_data=this.settings.last_submit_data,t.extra=this.settings.extra,t.nonce=this.settings.nonce,void 0!==this.settings.has_lead&&(t.has_lead=this.settings.has_lead,t.leads_id=this.settings.leads_id),this.load_ajax(t),this.handleDiviPopup()},load_ajax:function(o){var i=this;l.ajax({type:"POST",url:f.ForminatorFront.ajaxUrl,data:o,cache:!1,beforeSend:function(){l(a).trigger("before.load.forminator",o.id)},success:function(t){if(t.success){var e=t.data;if(l(a).trigger("response.success.load.forminator",o.id,t),!e.is_ajax_load)return!1;var r,n=[];(n=void 0===e.pagination_config&&void 0!==e.options.pagination_config?e.options.pagination_config:n)&&(f.Forminator_Cform_Paginations=f.Forminator_Cform_Paginations||[],f.Forminator_Cform_Paginations[o.id]=n),i.frontOptions=e.options||null,void 0===f.Forminator_Cform_Paginations&&i.frontOptions.pagination_config&&(f.Forminator_Cform_Paginations=f.Forminator_Cform_Paginations||[],f.Forminator_Cform_Paginations[o.id]=i.frontOptions.pagination_config),void 0!==e.lead_options&&(i.leadFrontOptions=e.lead_options||null,void 0===f.Forminator_Cform_Paginations)&&i.leadFrontOptions.pagination_config&&(f.Forminator_Cform_Paginations=f.Forminator_Cform_Paginations||[],f.Forminator_Cform_Paginations[o.leads_id]=i.leadFrontOptions.pagination_config),e.html&&(n=e.style||null,r=e.script||null,i.render_html(e.html,n,r)),e.styles&&i.maybe_append_styles(e.styles),e.scripts&&i.maybe_append_scripts(e.scripts),!e.scripts&&i.frontOptions&&i.init_front()}else l(a).trigger("response.error.load.forminator",o.id,t)},error:function(){l(a).trigger("request.error.load.forminator",o.id)}}).always(function(){l(a).trigger("after.load.forminator",o.id)})},render_html:function(t,e,r){var n=this.settings.id,o=this.settings.render_id,i="",a=null;(a=this.$el.find(".forminator-response-message")).length&&(i=a.get(0).outerHTML),(a=this.$el.find(".forminator-poll-response-message")).length&&(i=a.get(0).outerHTML),this.$el.parent().hasClass("forminator-guttenberg")?this.$el.parent().html(t):this.$el.replaceWith(t),i&&(l("#forminator-module-"+n+"[data-forminator-render="+o+"] .forminator-response-message").replaceWith(i),l("#forminator-module-"+n+"[data-forminator-render="+o+"] .forminator-poll-response-message").replaceWith(i)),e&&(l("style#forminator-module-"+n).length&&l("style#forminator-module-"+n).remove(),l("body").append(e)),r&&l("body").append(r)},maybe_append_styles:function(t){for(var e in t){var r;t.hasOwnProperty(e)&&!l("link#"+e).length&&((r=l("<link>")).attr("rel","stylesheet"),r.attr("id",e),r.attr("type","text/css"),r.attr("media","all"),r.attr("href",t[e].src),l("head").append(r))}},maybe_append_scripts:function(t){var e,r=[],n=l("body").find(".hustle-ui").length,o=l("body").find("script[src^='https://www.paypal.com/sdk/js']").attr("src");for(e in t)if(t.hasOwnProperty(e)){var i=t[e].on,a=t[e].load;if("window"===i){if(f[a]&&"forminator-google-recaptcha"!==e&&0===n)continue}else if("$"===i&&l.fn[a])continue;i={};i.src=t[e].src,i.src!==o&&(r.push(i),this.scriptsQue.push(e))}if(this.scriptsQue.length)for(var s in r)r.hasOwnProperty(s)&&this.load_script(r[s]);else this.init_front()},load_script:function(t){var e=this,r=a.createElement("script"),n=a.getElementsByTagName("body")[0];r.type="text/javascript",r.src=t.src,r.async=!0,r.defer=!0,r.onload=function(){e.script_on_load()},0===l('script[src="'+r.src+'"]').length?n.appendChild(r):e.script_on_load()},script_on_load:function(){this.scriptsQue.pop(),this.scriptsQue.length||this.init_front()},init_front:function(){var t,e,r,n;this.frontInitCalled||(this.frontInitCalled=!0,n=this.settings.id,t=this.settings.render_id,e=this.frontOptions||null,r=this.leadFrontOptions||null,e&&l("#forminator-module-"+n+'[data-forminator-render="'+t+'"]').forminatorFront(e),void 0!==this.settings.has_lead&&r&&(n=this.settings.leads_id,l("#forminator-module-"+n+'[data-forminator-render="'+t+'"]').forminatorFront(r)),this.init_window_vars())},init_window_vars:function(){var t;"undefined"!=typeof ForminatorValidationErrors&&void 0!==(t=jQuery(ForminatorValidationErrors.selector).data("forminatorFrontSubmit"))&&t.show_messages(ForminatorValidationErrors.errors),"undefined"!=typeof ForminatorFormHider&&void 0!==(t=jQuery(ForminatorFormHider.selector).data("forminatorFront"))&&t.hide()},handleDiviPopup:function(){var e=this;"undefined"!=typeof DiviArea&&DiviArea.addAction("show_area",function(t){0!==t.find("#"+e.element.id).length&&(e.frontInitCalled=!1,e.init_front(),forminator_render_hcaptcha())})}}),l.fn[r]=function(t){return this.each(function(){l.data(this,r)||l.data(this,r,new e(this,t))})}}(jQuery,window,document),function(l,f,s){"use strict";var r="forminatorFront",n={form_type:"custom-form",rules:{},messages:{},conditions:{},inline_validation:!1,print_value:!1,chart_design:"bar",chart_options:{},forminator_fields:[],general_messages:{calculation_error:"Failed to calculate field.",payment_require_ssl_error:"SSL required to submit this form, please check your URL.",payment_require_amount_error:"PayPal amount must be greater than 0.",form_has_error:"Please correct the errors before submission."},payment_require_ssl:!1};function e(t,e){this.element=t,this.$el=l(this.element),this.forminator_selector="#"+l(this.element).attr("id")+'[data-forminator-render="'+l(this.element).data("forminator-render")+'"]',this.forminator_loader_selector='div[data-forminator-render="'+l(this.element).data("forminator-render")+'"][data-form="'+l(this.element).attr("id")+'"]',this.settings=l.extend({},n,e),void 0!==this.settings.messages&&(this.settings.messages=this.maybeParseStringToJson(this.settings.messages,"object")),void 0!==this.settings.rules&&(this.settings.rules=this.maybeParseStringToJson(this.settings.rules,"object")),void 0!==this.settings.calendar&&(this.settings.calendar=this.maybeParseStringToJson(this.settings.calendar,"array")),this._defaults=n,this._name=r,this.form_id=0,this.template_type="",this.init(),this.handleDiviPopup()}function t(){l(".forminator-custom-form").find(".forminator-label").on("click",function(t){t.preventDefault();t=l(this);t.next("#"+t.attr("for")).focus()})}l.extend(e.prototype,{init:function(){var e=this;switch(0<this.$el.find('input[name="form_id"]').length&&(this.form_id=this.$el.find('input[name="form_id"]').val()),0<this.$el.find('input[name="form_type"]').length&&(this.template_type=this.$el.find('input[name="form_type"]').val()),l(this.forminator_loader_selector).remove(),0===this.$el.closest(".wph-modal").length&&this.$el.show(),l(s).on("hustle:module:displayed",function(t,e){l(".wph-modal-active").find("form").css("display","")}),e.reint_intlTelInput(),setTimeout(function(){l(".wph-modal-active").find("form").css("display","")},10),this.settings.form_type){case"custom-form":l(this.element).each(function(){e.init_custom_form(this)}),this.$el.on("forminator-clone-group",function(t){e.init_custom_form(t.target)});break;case"poll":this.init_poll_form();break;case"quiz":this.init_quiz_form()}var t={form_type:e.settings.form_type,forminator_selector:e.forminator_selector,chart_design:e.settings.chart_design,chart_options:e.settings.chart_options,has_quiz_loader:e.settings.has_quiz_loader,has_loader:e.settings.has_loader,loader_label:e.settings.loader_label,resetEnabled:e.settings.is_reset_enabled,inline_validation:e.settings.inline_validation};"leads"!==this.template_type&&"quiz"!==this.settings.form_type||(t.form_placement=e.settings.form_placement,t.hasLeads=e.settings.hasLeads,t.leads_id=e.settings.leads_id,t.quiz_id=e.settings.quiz_id,t.skip_form=e.settings.skip_form),l(this.element).forminatorFrontSubmit(t),this.activate_field(),this.small_form()},init_custom_form:function(t){var e,r,n=this,o=this.$el.find(".forminator-save-draft-link"),i=0!==o.length,a=(this.init_intlTelInput_validation(t),this.settings.inline_validation&&l(t).forminatorFrontValidate({rules:n.settings.rules,messages:n.settings.messages}),l(t).forminatorFrontCalculate({forminatorFields:n.settings.forminator_fields,generalMessages:n.settings.general_messages,memoizeTime:n.settings.calcs_memoize_time||300}),l(t).forminatorFrontMergeTags({forminatorFields:n.settings.forminator_fields,print_value:n.settings.print_value}),this.init_pagination(t),l(t).find('div[data-is-payment="true"], input[data-is-payment="true"]').first(),n.settings.has_stripe&&(r=l(this.element).find(".forminator-stripe-element").first(),l(n.element).is(":visible")&&this.renderStripe(n,r),l(s).on("hustle:module:displayed",function(){n.renderStripe(n,r)})),!n.settings.has_paypal||l(n.element).closest(".et_pb_section").length&&!l(n.element).is(":visible")||l(this.element).forminatorFrontPayPal({type:"paypal",paymentEl:this.settings.paypal_config,paymentRequireSsl:n.settings.payment_require_ssl,generalMessages:n.settings.general_messages,has_loader:n.settings.has_loader,loader_label:n.settings.loader_label}),l(t).forminatorFrontCondition(this.settings.conditions,this.settings.calendar),this.init_fui(t),l(t).find(".forminator-datepicker").forminatorFrontDatePicker(this.settings.calendar),this.responsive_captcha(t),this.field_counter(t),this.field_number(t),this.field_time(),l(t).find(".forminator-multi-upload").forminatorFrontMultiFile(this.$el),this.upload_field(t),this.init_login_2FA(),n.maybeRemoveDuplicateFields(t),n.checkComplianzBlocker(),l(f).on("resize",function(){n.responsive_captcha(t)}),l(f).on("load",function(){n.maybeRemoveDuplicateFields(t)}),i?this.$el.serializeArray():"");this.$el.find(".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea, .forminator-field-signature").on("change input",function(t){i&&o.hasClass("disabled")&&(clearTimeout(e),e=setTimeout(function(){n.maybe_enable_save_draft(o,a)},500))}),void 0!==n.settings.hasLeads&&("beginning"===n.settings.form_placement&&l("#forminator-module-"+this.settings.quiz_id).css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0}),"end"===n.settings.form_placement)&&l(t).css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0})},init_poll_form:function(){var o=this,i=this.$el.find("fieldset"),t=this.$el.find(".forminator-radio input"),a=this.$el.find(".forminator-input"),s=a.closest(".forminator-field");FUI.inputStates(a),t.on("click",function(){s.addClass("forminator-hidden"),s.attr("aria-hidden","true"),a.removeAttr("tabindex"),a.attr("name","");var t,e=this.checked,r=l(this).attr("id"),n=l(this).attr("name");return i.removeClass("forminator-has_error"),o.$el.find(".forminator-input#"+r+"-extra").length&&(t=(r=o.$el.find(".forminator-input#"+r+"-extra")).closest(".forminator-field"),e?(r.attr("name",n+"-extra"),t.removeClass("forminator-hidden"),t.removeAttr("aria-hidden"),r.attr("tabindex","-1"),r.focus()):(t.addClass("forminator-hidden"),t.attr("aria-hidden","true"),r.removeAttr("tabindex"))),!0}),this.$el.hasClass("forminator-poll-disabled")&&this.$el.find(".forminator-radio").each(function(){l(this).addClass("forminator-disabled"),l(this).find("input").attr("disabled",!0)})},init_quiz_form:function(){var a=this,t=void 0!==a.settings.form_placement?a.settings.form_placement:"",e=void 0!==a.settings.quiz_id?a.settings.quiz_id:0;this.$el.find(".forminator-button:not(.forminator-quiz-start)").each(function(){l(this).prop("disabled",!0)}),this.$el.find(".forminator-answer input").each(function(){l(this).attr("checked",!1)}),this.$el.find(".forminator-result--info button").on("click",function(){location.reload()}),l("#forminator-quiz-leads-"+e+" .forminator-quiz-intro .forminator-quiz-start").on("click",function(t){t.preventDefault(),l(this).closest(".forminator-quiz-intro").hide(),a.$el.prepend('<button class="forminator-button forminator-quiz-start forminator-hidden"></button>').find(".forminator-quiz-start").trigger("click").remove()}),this.$el.on("click",".forminator-quiz-start",function(t){t.preventDefault(),a.$el.find(".forminator-quiz-intro").hide(),a.$el.find(".forminator-pagination").removeClass("forminator-hidden");t={totalSteps:a.$el.find(".forminator-pagination").length-1,step:0,quiz:!0};a.settings.text_next&&(t.next_button=a.settings.text_next),a.settings.text_prev&&(t.prev_button=a.settings.text_prev),a.settings.submit_class&&(t.submitButtonClass=a.settings.submit_class),l(a.element).forminatorFrontPagination(t)}),"end"!==t&&this.$el.find(".forminator-submit-rightaway").on("click",function(){a.$el.submit(),l(this).closest(".forminator-question").find(".forminator-submit-rightaway").addClass("forminator-has-been-disabled").attr("disabled","disabled")}),a.settings.hasLeads&&("beginning"===t&&a.$el.css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0}),"end"===t)&&(a.$el.closest("div").find("#forminator-module-"+a.settings.leads_id).css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0}),l("#forminator-quiz-leads-"+e+" .forminator-lead-form-skip").hide()),this.$el.on("click",".forminator-social--icon a",function(t){t.preventDefault();var t=l(this).data("social"),e=l(this).closest(".forminator-social--icons").data("url"),r=l(this).closest(".forminator-social--icons").data("message"),e={facebook:"https://www.facebook.com/sharer/sharer.php?u="+e+"&quote="+(r=encodeURIComponent(r)),twitter:"https://twitter.com/intent/tweet?&url="+e+"&text="+r,google:"https://plus.google.com/share?url="+e,linkedin:"https://www.linkedin.com/shareArticle?mini=true&url="+e+"&title="+r};if(void 0!==e[t])return r=f.open(e[t],t,"height="+l(f).height()+",width="+l(f).width()),f.focus&&r.focus(),!1}),this.$el.on("change",".forminator-answer input",function(t){var e=!!l(this).closest(".forminator-pagination").length,r=e?l(this).closest(".forminator-pagination"):a.$el,n=r.find(".forminator-answer input:checked").length,o=r.find(".forminator-question").length,r=l(this).closest(".forminator-question"),i=r.data("multichoice");a.$el.find(".forminator-button:not(.forminator-button-back)").each(function(){var t=n<o;l(this).prop("disabled",t),e&&(t?l(this).addClass("forminator-disabled"):l(this).removeClass("forminator-disabled"))}),this.checked&&!1===i&&r.find(".forminator-answer").not(l(this).parent(".forminator-answer")).each(function(t,e){l(e).find("> input").prop("checked",!1)})})},small_form:function(){var t,e=l(this.element),r=e.width();783<Math.max(s.documentElement.clientWidth,f.innerWidth||0)&&(e.hasClass("forminator-size--small")?480<r&&e.removeClass("forminator-size--small"):(t=e.closest(".hustle-content"),e.is(":visible")&&r<=480&&!t.length&&e.addClass("forminator-size--small")))},init_intlTelInput_validation:function(t){var a=l(t),s=a.is(".forminator-design--material");a.find(".forminator-field--phone").each(function(){var t,e,r=this,n=l(this).data("national_mode"),o=l(this).data("country"),i=l(this).data("validation");void 0!==n&&(n={nationalMode:"enabled"===n,initialCountry:void 0!==o?o:"us",utilsScript:f.ForminatorFront.cform.intlTelInput_utils_script},void 0!==i&&"standard"===i&&(n.allowDropdown=!1),void 0!==i&&"international"===i&&(n.autoHideDialCode=!1),t=l(this).intlTelInput(n),void 0!==i&&"international"===i&&(e="+"+(n=l(this).intlTelInput("getSelectedCountryData").dialCode))!==l(this).val()&&(n=l(this).val().trim().replace(n,"").replace("+",""),l(this).val(e+n)),void 0!==i&&"standard"===i&&l(this).on("blur",function(){""===l(r).val()&&(t.intlTelInput("setCountry",o),a.validate().element(l(r)))}),l(this).on("input",function(){var t,e=l(r).intlTelInput("getSelectedCountryData"),e=e&&e.iso2?e.iso2.toUpperCase():"";""!==e&&(t=l(this).val(),"TOO_LONG"!==libphonenumber.validatePhoneNumberLength(t,e)?(e=new libphonenumber.AsYouType(e).input(t),l(this).val(e)):l(this).val(t.slice(0,t.length-1)))}),s?(l(this).closest(".forminator-field").find("div.iti").addClass("forminator-input-with-phone"),l(this).closest(".forminator-field").find("div.iti").hasClass("iti--allow-dropdown")&&l(this).closest(".forminator-field").find(".forminator-label").addClass("iti--allow-dropdown")):l(this).closest(".forminator-field").find("div.iti").addClass("forminator-phone"))})},reint_intlTelInput:function(){var r=this;r.$el.on("after:forminator:form:submit",function(t,e){r.init_intlTelInput_validation(r.forminator_selector)})},init_fui:function(t){var t=l(t),e=t.find(".forminator-input"),r=t.find(".forminator-textarea"),n=t.find(".forminator-select2"),o=t.find(".forminator-multiselect"),i=t.find(".forminator-stripe-element");t.find(".forminator-slider"),t.attr("data-design"),t.attr("data-design"),t.attr("data-design"),t.attr("data-design");e.length&&e.each(function(){FUI.inputStates(this)}),r.length&&r.each(function(){FUI.textareaStates(this)}),"function"==typeof FUI.select2&&FUI.select2(n.length),"function"==typeof FUI.slider&&FUI.slider(),o.length&&FUI.multiSelectStates(o),t.hasClass("forminator-design--material")&&(e.length&&e.each(function(){FUI.inputMaterial(this)}),r.length&&r.each(function(){FUI.textareaMaterial(this)}),i.length)&&i.each(function(){var t=l(this).closest(".forminator-field"),e=t.find(".forminator-label");e.length&&(t.addClass("forminator-stripe-floating"),e.addClass("forminator-floating--input"))})},responsive_captcha:function(t){l(t).find(".forminator-g-recaptcha").each(function(){var t=l(this).data("badge");l(this).is(":visible")&&"inline"===t&&(t=(t=l(this).parent().width())<302?t/302:1,l(this).css("transform","scale("+t+")"),l(this).css("-webkit-transform","scale("+t+")"),l(this).css("transform-origin","0 0"),l(this).css("-webkit-transform-origin","0 0"))})},init_pagination:function(t){var t=l(t).find(".forminator-pagination").length,e=f.location.hash,r=!1,n=0;0<t&&(void 0!==e&&0<=e.indexOf("step-")&&(r=!0,n=e.substr(6,8)),l(this.element).forminatorFrontPagination({totalSteps:t,hashStep:r,step:n,inline_validation:this.settings.inline_validation,submitButtonClass:this.settings.submit_button_class}))},activate_field:function(){var t=l(this.element),e=t.find(".forminator-input"),r=t.find(".forminator-textarea");function n(t){var r=l(t),n=r.val().trim(),o=r.closest(".forminator-field"),i=r.attr("data-field"),a=r.closest(".forminator-timepicker").parent(),s=o.find(".forminator-error-message");r.on("load change keyup keydown",function(t){var e;void 0!==i&&!1!==i?("hours"===r.data("field")&&(e=a.find('.forminator-error-message[data-error-field="hours"]'),""!==n)&&0!==e.length&&e.remove(),"minutes"===r.data("field")&&(e=a.find('.forminator-error-message[data-error-field="minutes"]'),""!==n)&&0!==e.length&&e.remove()):""!==n&&s.text()&&(s.remove(),o.removeClass("forminator-has_error")),t.stopPropagation()})}function o(){t.find(".select2-container").hasClass("select2-container--open")?setTimeout(o,300):t.find(".select2-container").closest(".forminator-field").removeClass("forminator-is_active")}e.length&&e.each(function(){n(this)}),r.length&&r.each(function(){n(this)}),t.find("select.forminator-select2 + .forminator-select").each(function(){var e=l(this);e.on("mouseover",function(t){t.stopPropagation(),l(this).closest(".forminator-field").addClass("forminator-is_hover")}).on("mouseout",function(t){t.stopPropagation(),l(this).closest(".forminator-field").removeClass("forminator-is_hover")}),e.on("click",function(t){t.stopPropagation(),o(),e.hasClass("select2-container--open")?l(this).closest(".forminator-field").addClass("forminator-is_active"):l(this).closest(".forminator-field").removeClass("forminator-is_active")})})},field_counter:function(t){var t=l(t),e=t.find(".forminator-button-submit");t.find(".forminator-input, .forminator-textarea").each(function(){var t=l(this),n=0;t.on("keydown",function(t){if(!l(this).hasClass("forminator-textarea")&&13===t.keyCode)return t.preventDefault(),e.is(":visible")&&e.trigger("click"),!1}),t.on("change keyup keydown",function(t){t.stopPropagation();var e=l(this).closest(".forminator-col").find(".forminator-description span"),r="string"!=typeof(r=l(this).val())?r:String(r).replace(/[&\/\\#^+()$~%.'":*?<>{}!@]/g,"").trim();e.length&&e.data("limit")&&(r=r.replace(/<[^>]*>/g,""),"words"!==e.data("type")?n=l("<div>"+r+"</div>").text().length:(n=r.trim().split(/\s+/).length,r.trim().split(/\s+/).length>=e.data("limit")&&32===t.which&&t.preventDefault()),e.html(n+" / "+e.data("limit")))})})},field_number:function(t){t=l(t);t.find("input[type=number]").each(function(){l(this).keypress(function(t){for(var e=[44,45,46],r=t.which,n=48;n<58;n++)e.push(n);0<=e.indexOf(r)||t.preventDefault()})}),t.find(".forminator-number--field, .forminator-currency, .forminator-calculation").each(function(){var e;"number"===l(this).attr("type")&&(e=l(this).data("decimals"),l(this).change(function(t){this.value=parseFloat(this.value).toFixed(e)}),l(this).trigger("change")),l(this).inputmask({alias:"decimal",rightAlign:!1,digitsOptional:!1,showMaskOnHover:!1,autoUnmask:!0,removeMaskOnSubmit:!0})}),t.find("input[type=number]").on("mouseout",function(){l(this).trigger("blur")})},field_time:function(){var s=this;l(".forminator-input-time").on("input",function(t){var e=l(this),r=e.val();r&&2<=r.length&&e.val(r.substr(0,2))}),this.$el.find(".forminator-timepicker").each(function(t,e){var r,n,o=l(e),i=o.data("start-limit"),a=o.data("end-limit");void 0!==i&&void 0!==a&&(r=o.find(".time-hours"),n=r.html(),s.resetTimePicker(o,i,a),o.find(".time-ampm").on("change",function(){r.val(""),r.html(n),s.resetTimePicker(o,i,a),setTimeout(function(){o.find(".forminator-field").removeClass("forminator-has_error")},10)}))})},resetTimePicker:function(t,e,r){var n=t.find(".time-ampm"),[e,o]=e.split(" "),[i,,]=e.split(":"),i=parseInt(i),[e,a]=r.split(" "),[s,,]=e.split(":"),s=parseInt(s);o===a&&n.find('option[value!="'+a+'"]').remove(),t.find(".time-hours").children().each(function(t,e){var r=parseInt(e.value);""!==r&&(r<i||0!==i&&12===r)&&n.val()===o&&e.remove(),""!==r&&s<r&&12!==r&&n.val()===a&&e.remove()})},init_login_2FA:function(){var e=this;this.two_factor_providers("totp"),l("body").on("click",".forminator-2fa-link",function(){e.$el.find("#login_error").remove(),e.$el.find(".notification").empty();var t=l(this).data("slug");e.two_factor_providers(t),"fallback-email"===t&&e.resend_code()}),this.$el.find(".wpdef-2fa-email-resend input").on("click",function(){e.resend_code()})},two_factor_providers:function(t){var e=this;e.$el.find(".forminator-authentication-box").hide(),e.$el.find(".forminator-authentication-box input").attr("disabled",!0),e.$el.find("#forminator-2fa-"+t).show(),e.$el.find("#forminator-2fa-"+t+" input").attr("disabled",!1),0<e.$el.find(".forminator-2fa-link").length&&(e.$el.find(".forminator-2fa-link").hide(),e.$el.find(".forminator-2fa-link:not(#forminator-2fa-link-"+t+")").each(function(){e.$el.find(".forminator-auth-method").val(t),l(this).find("input").attr("disabled",!1),l(this).show()}))},resend_code:function(){var e=l('input[name="button_resend_code"]'),t=l(".forminator-auth-token"),t={action:"forminator_2fa_fallback_email",data:JSON.stringify({token:t})};l.ajax({type:"POST",url:f.ForminatorFront.ajaxUrl,data:t,beforeSend:function(){e.attr("disabled","disabled"),l(".def-ajaxloader").show()},success:function(t){e.removeAttr("disabled"),l(".def-ajaxloader").hide(),l(".notification").text(t.data.message)}})},material_field:function(){},toggle_file_input:function(){l(this.element).find(".forminator-file-upload").each(function(){var t=l(this),e=t.find("input"),t=t.find(".forminator-button-delete");""!==e.val()?t.show():t.hide()})},upload_field:function(t){var r=this,e=l(t);this.toggle_file_input(),e.find(".forminator-button-delete").on("click",function(t){t.preventDefault();var t=l(this),e=t.siblings("input"),r=t.closest(".forminator-file-upload").find("> span");e.val(""),r.html(r.data("empty-text")),t.hide()}),e.find(".forminator-input-file, .forminator-input-file-required").on("change",function(){var t=l(this).closest(".forminator-file-upload").find("> span"),e=l(this).val(),e=e.length?e.split("\\").pop():"";t.text(e),r.toggle_file_input()}),e.find(".forminator-button-upload").off(),e.find(".forminator-button-upload").on("click",function(t){t.preventDefault();t=l(this).attr("data-id");e.find("input#"+t).trigger("click")}),e.find(".forminator-input-file, .forminator-input-file-required").on("change",function(t){t.preventDefault();var t=l(this)[0].files.length,e=l(this).find(".forminator-button-delete");0===t?e.hide():e.show()})},maybeRemoveDuplicateFields:function(t){var e,r,t=l(t);l(s).find("link[id='neira-lite-style-css']").length&&(e=t.find(".forminator-select-container").next(".chosen-container"),r=t.find("select.forminator-select2 + .forminator-select").next(".chosen-container"),t=t.find(".forminator-select").next(".chosen-container"),0!==e.length&&e.remove(),0!==r.length&&r.remove(),0!==t.length)&&t.remove()},renderCaptcha:function(t){var e,r,n=this;void 0===l(t).data("forminator-recapchta-widget")&&(r=l(t).data("size"),e={sitekey:l(t).data("sitekey"),theme:l(t).data("theme"),size:r},"invisible"===r?(e.badge=l(t).data("badge"),e.callback=function(t){l(n.element).trigger("submit.frontSubmit")}):e.callback=function(){l(t).parent(".forminator-col").removeClass("forminator-has_error").remove(".forminator-error-message")},""!==e.sitekey)&&(r=f.grecaptcha.render(t,e),l(t).data("forminator-recapchta-widget",r),this.addCaptchaAria(t),this.responsive_captcha())},renderHcaptcha:function(t){var e,r,n=this;void 0===l(t).data("forminator-hcaptcha-widget")&&(r=l(t).data("size"),(e={sitekey:l(t).data("sitekey"),theme:l(t).data("theme"),size:r}).callback="invisible"===r?function(t){l(n.element).trigger("submit.frontSubmit")}:function(){l(t).parent(".forminator-col").removeClass("forminator-has_error").remove(".forminator-error-message")},""!==e.sitekey)&&(r=hcaptcha.render(t,e),l(t).data("forminator-hcaptcha-widget",r))},addCaptchaAria:function(t){var e=l(t).find(".g-recaptcha-response"),t=l(t).find(">div");0!==e.length&&(e.attr("aria-hidden","true"),e.attr("aria-label","do not use"),e.attr("aria-readonly","true")),0!==t.length&&t.css("z-index",99)},hide:function(){this.$el.hide()},maybeParseStringToJson:function(t,e){var r={};if("object"==typeof t)return t;if("object"===e)t="{"+t.trim()+"}";else{if("array"!==e)return{};t="["+t.trim()+"]"}try{t=t.replace(/\,(?!\s*?[\{\[\"\'\w])/g,""),r=JSON.parse(t)}catch(t){console.error(t.message),"object"===e?r={}:"array"===e&&(r=[])}return r},renderStripe:function(t,e,r=0){var n=this;setTimeout(function(){r++,"undefined"!=typeof Stripe?l(t.element).forminatorFrontPayment({type:"stripe",paymentEl:e,paymentRequireSsl:t.settings.payment_require_ssl,generalMessages:t.settings.general_messages,has_loader:t.settings.has_loader,loader_label:t.settings.loader_label}):r<300?n.renderStripe(t,e,r):console.error("Failed to load Stripe.")},100)},maybe_enable_save_draft:function(t,e){var r=this.$el.serializeArray(),n=!1,o=!!this.$el.find(".forminator-field-signature").length,r=r.filter(function(t){return-1===t.name.indexOf("ctlSignature")});(e=JSON.stringify(e))!==(r=JSON.stringify(r))&&(n=!0),o&&!1===n&&this.$el.find(".forminator-field-signature").each(function(t){var e=l(this).find(".signature-prefix").val();if(0!==l(this).find("#ctlSignature"+e+"_data").length&&""!==l(this).find("#ctlSignature"+e+"_data").val())return!(n=!0)}),n?t.removeClass("disabled"):t.addClass("disabled")},handleDiviPopup:function(){var e=this;"undefined"!=typeof DiviArea&&DiviArea.addAction("show_area",function(t){setTimeout(function(){e.init(),forminatorSignInit(),forminatorSignatureResize()},100)})},disableFields:function(){this.$el.addClass("forminator-fields-disabled")},checkComplianzBlocker:function(){var t=this.$el.find(".cmplz-blocked-content-container");0<t.length&&(t=t.closest(".forminator-row"),this.disableFields(),t.insertBefore(this.$el.find(".forminator-row").first()),t.css({"pointer-events":"all",opacity:"1"}),t.find("*").css("pointer-events","all"),0<t.closest(".forminator-pagination--content").length&&(t.closest(".forminator-pagination--content").css({"pointer-events":"all",opacity:"1"}),t.nextAll(".forminator-row").css({opacity:"0.5"})),l("body").on("click",".cmplz-blocked-content-notice, .cmplz-accept",function(){setTimeout(function(){f.location.reload()},50)}))}}),l.fn[r]=function(t){return this.each(function(){l.data(this,r)||l.data(this,r,new e(this,t))})},l(s).on("tinymce-editor-init",function(t,e){var r=e.id,n=l("#"+r).closest(".forminator-col");e.on("change",function(){-1!==r.indexOf("forminator-field-textarea-")&&(e.save(),n.find("#"+r).trigger("change")),-1!==r.indexOf("forminator-field-post-content-")&&(e.save(),n.find("#"+r).trigger("change"))}),e.on("blur",function(){-1===r.indexOf("forminator-field-textarea-")&&-1===r.indexOf("forminator-field-post-content-")||n.find("#"+r).valid()}),l("#"+e.id+"_ifr").is(":visible")&&l("#"+e.id+"_ifr").height(l("#"+e.id).height()),-1!==r.indexOf("forminator")&&l("#"+r).closest(".wp-editor-wrap").attr("aria-describedby",r+"-description")}),l(s).on("click",".forminator-copy-btn",function(t){var e=l(this).prev(".forminator-draft-link").val();if(navigator.clipboard)navigator.clipboard.writeText(e).then(function(){},function(t){});else{var r=s.createElement("textarea");r.value=e,r.style.top="0",r.style.left="0",r.style.position="fixed",s.body.appendChild(r),r.focus(),r.select();try{s.execCommand("copy")}catch(t){}s.body.removeChild(r)}l(this).hasClass("copied")||(l(this).addClass("copied"),l(this).prepend("&check;  "))}),t(),l(s).on("after.load.forminator",t),jQuery(s).on("elementor/popup/show",()=>{forminator_render_captcha(),forminator_render_hcaptcha()})}(jQuery,window,document);var forminator_render_captcha=function(){jQuery(".forminator-g-recaptcha").each(function(){var e=jQuery(this),r=e.closest("form");0<r.length&&""===e.html()&&window.setTimeout(function(){var t=r.data("forminatorFront");void 0!==t&&t.renderCaptcha(e[0])},100)})},forminator_render_hcaptcha=function(){jQuery(".forminator-hcaptcha").each(function(){var e=jQuery(this),r=e.closest("form");0<r.length&&""===e.html()&&window.setTimeout(function(){var t=r.data("forminatorFront");void 0!==t&&t.renderHcaptcha(e[0])},100)})},forminatorDateUtil={month_number:function(t){var e,r;return t.constructor===Number?t:(r=NaN,t.constructor===String&&(t=t.toLowerCase(),r=-1===(e=-1===(e=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"].indexOf(t))?["january","february","march","april","may","june","july","august","september","october","november","december"].indexOf(t):e)?NaN:e),r)},convert:function(t){return t.constructor===Date?t:t.constructor===Array?new Date(t[0],this.month_number(t[1]),t[2]):jQuery.isNumeric(t)?new Date(+t):t.constructor===Number||t.constructor===String?new Date(t):"object"==typeof t?new Date(t.year,this.month_number(t.month),t.date):NaN},compare:function(t,e){return isFinite(t=this.convert(t).valueOf())&&isFinite(e=this.convert(e).valueOf())?(e<t)-(t<e):NaN},inRange:function(t,e,r){return isFinite(t=this.convert(t).valueOf())&&isFinite(e=this.convert(e).valueOf())&&isFinite(r=this.convert(r).valueOf())?e<=t&&t<=r:NaN},diffInDays:function(t,e){return t=this.convert(t),e=this.convert(e),"function"!=typeof t.getMonth||"function"!=typeof e.getMonth?NaN:(e=e.getTime(),t=t.getTime(),parseFloat((e-t)/864e5))},diffInWeeks:function(t,e){return t=this.convert(t),e=this.convert(e),"function"!=typeof t.getMonth||"function"!=typeof e.getMonth?NaN:(e=e.getTime(),t=t.getTime(),parseInt((e-t)/6048e5))},diffInMonths:function(t,e){var r,n;return t=this.convert(t),e=this.convert(e),"function"!=typeof t.getMonth||"function"!=typeof e.getMonth?NaN:(r=t.getFullYear(),n=e.getFullYear(),t=t.getMonth(),e.getMonth()+12*n-(t+12*r))},diffInYears:function(t,e){return t=this.convert(t),e=this.convert(e),"function"!=typeof t.getMonth||"function"!=typeof e.getMonth?NaN:e.getFullYear()-t.getFullYear()}};!function(s,o,u){"use strict";var r="forminatorFrontCalculate",n={forminatorFields:[],generalMessages:{}};function e(t,e){this.element=t,this.$el=s(this.element),this.settings=s.extend({},n,e),this._defaults=n,this._name=r,this.calculationFields=[],this.triggerInputs=[],this.isError=!1,this.init()}s.extend(e.prototype,{init:function(){var e=this,t=this.$el.find("input.forminator-calculation");0<t.length&&(t.each(function(){var t;e.calculationFields.push({$input:s(this),formula:s(this).data("formula"),name:s(this).attr("name"),isHidden:s(this).data("isHidden"),precision:s(this).data("precision")}),s(this).data("isHidden")&&(s(this).closest(".forminator-col").addClass("forminator-hidden forminator-hidden-option"),(t=s(this).closest(".forminator-row")).addClass("forminator-hidden-option"),0===t.find("> .forminator-col:not(.forminator-hidden)").length)&&t.addClass("forminator-hidden")}),t=this.settings.memoizeTime||300,this.debouncedReCalculateAll=this.debounce(this.recalculateAll,1e3),this.memoizeDebounceRender=this.memoize(this.recalculate,t),this.$el.on("forminator:field:condition:toggled",function(t){e.debouncedReCalculateAll()}),this.parseCalcFieldsFormula(),this.attachEventToTriggeringFields(),this.debouncedReCalculateAll()),this.$el.off("forminator:recalculate").on("forminator:recalculate",function(){e.recalculateAll()})},memoize:function(e,r){var n,o={},i=Array.prototype.slice;return function(){var t=i.call(arguments);return clearTimeout(n),n=setTimeout(function(){n=null,o={}},r),t[0].name in o?o[t[0].name]:o[t[0].name]=e.apply(this,t)}},debounce:function(n,o,i){var a;return function(){var t=this,e=arguments,r=i&&!a;clearTimeout(a),a=setTimeout(function(){a=null,i||n.apply(t,e)},o),r&&n.apply(t,e)}},parseCalcFieldsFormula:function(){for(var t=0;t<this.calculationFields.length;t++){var e=this.calculationFields[t],r=e.formula;e.formula=r,this.calculationFields[t]=e}},findTriggerInputs:function(t){for(var e=t.formula,r=this.settings.forminatorFields.join("|"),n=new RegExp("\\{("+("("+r+")-\\d+")+"(?:-min|-max)?)(\\-[A-Za-z-_]+)?(\\-[A-Za-z0-9-_]+)?\\}","g"),e=this.maybeReplaceCalculationGroups(e);a=n.exec(e);){var o=a[0],i=a[4]||"",i=a[1]+i,a=a[2];if(o!==u&&i!==u&&a!==u){o=this.get_form_field(i);if(o.length){for(var s=o.data("calcFields"),l=(s===u&&(s=[]),!1),f=0;f<s.length;f++)if(s[f].name===t.name){l=!0;break}l||s.push(t),o.data("calcFields",s),this.triggerInputs.push(o)}}}},get_form_field:function(t){let e=this.$el;var r=(e=e.hasClass("forminator-grouped-fields")?e.closest("form.forminator-ui"):e).data("form-id"),n=e.data("uid"),r=e.find("#forminator-form-"+r+"__field--"+t+"_"+n);return r=0===r.length&&0===(r=e.find("#"+t+"-field")).length&&0===(r=e.find("input[name="+t+"]")).length&&0===(r=e.find("textarea[name="+t+"]")).length&&0===(r=e.find('input[name="'+t+'[]"]')).length&&0===(r=this.$el.find('select[name="'+t+'"]')).length?e.find("#"+t):r},attachEventToTriggeringFields:function(){for(var n=this,t=0;t<this.calculationFields.length;t++){var e=this.calculationFields[t];this.findTriggerInputs(e)}if(0<this.triggerInputs.length)for(var r=[],o=0;o<this.triggerInputs.length;o++){var i=this.triggerInputs[o],a=i.attr("id");r.indexOf(a)<0&&(i.on("change.forminatorFrontCalculate, blur",function(){var t=s(this).data("calcFields");if(t!==u&&0<t.length)for(var e=0;e<t.length;e++){var r=t[e];n.field_is_checkbox(s(this))||n.field_is_radio(s(this))?n.recalculate(r):n.memoizeDebounceRender(r)}}),r.push(a))}},recalculateAll:function(){for(var t=0;t<this.calculationFields.length;t++)this.recalculate(this.calculationFields[t])},recalculate:function(t){var e=t.$input,r=(this.hideErrorMessage(e),this.maybeReplaceFieldOnFormula(t.formula)),n=0,r=new o.forminatorCalculator(r);try{if(n=r.calculate(),!isFinite(n))throw"Infinity calculation result."}catch(t){this.isError=!0,console.log(t),this.displayErrorMessage(e,this.settings.generalMessages.calculation_error),n="0"}n=(+(Math.round(n+("e+"+t.precision))+("e-"+t.precision))).toFixed(t.precision),r=e.val(),t=e.data("decimal-point");r!==(n=String(n).replace(".",t))&&e.val(n).trigger("change")},maybeReplaceCalculationGroups:function(t){for(var e=new RegExp("\\{((?:calculation|number|slider|currency|radio|select|checkbox)-\\d+(?:-min|-max)?)-\\*\\}","g");n=e.exec(t);){var r=n[0],n=n[1],n=this.$el.find("[name='"+n+"'], [name='"+n+"[]'], [name^='"+n+"-']").map(function(){return"{"+this.name.replace("[]","")+"}"}).get();n="("+(n=s.unique(n.sort())).join("+")+")",t=t.replace(r,n)}return t},maybeReplaceFieldOnFormula:function(t){t=this.maybeReplaceCalculationGroups(t);for(var e=this.settings.forminatorFields.join("|"),r=new RegExp("\\{("+("("+e+")-\\d+")+"(?:-min|-max)?)(\\-[A-Za-z-_]+)?(\\-[A-Za-z0-9-_]+)?\\}","g"),n=t;s=r.exec(t);){var o,i=s[0],a=s[4]||"",a=s[1]+a,s=s[2],l=i;i!==u&&a!==u&&s!==u&&(this.is_hidden(a)?(l=0,"zero"!==this.get_form_field(a).data("hidden-behavior")&&(o=i.replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g,"\\$1"),!(o=new RegExp("([\\+\\-\\*\\/]?)[^\\+\\-\\*\\/\\(]*"+o+"[^\\)\\+\\-\\*\\/]*([\\+\\-\\*\\/]?)").exec(n))||"*"!==o[1]&&"/"!==o[1]&&"*"!==o[2]&&"/"!==o[2]||(l=1))):("calculation"===s&&(o=this.get_calculation_field(a))&&this.memoizeDebounceRender(o),l=this.get_field_value(a)),n=n.replace(i,l="("+l+")"))}return n},get_calculation_field:function(t){for(var e=0;e<this.calculationFields.length;e++)if(this.calculationFields[e].name===t)return this.calculationFields[e];return!1},is_hidden:function(t){var t=this.get_form_field(t).closest(".forminator-col"),e=t.closest(".forminator-row");return!(e.hasClass("forminator-hidden-option")||t.hasClass("forminator-hidden-option")||!e.hasClass("forminator-hidden")&&!t.hasClass("forminator-hidden"))},get_field_value:function(t){var t=this.get_form_field(t),e=0,r=0,n=null;return this.field_is_radio(t)?(n=t.filter(":checked")).length&&(r=n.data("calculation"))!==u&&(e=Number(r)):this.field_is_checkbox(t)?t.each(function(){s(this).is(":checked")&&(r=s(this).data("calculation"))!==u&&(e+=Number(r))}):this.field_is_select(t)?(n=t.find("option").filter(":selected")).length&&(r=n.data("calculation"))!==u&&(e=Number(r)):this.field_has_inputMask(t)?e=parseFloat(t.inputmask("unmaskedvalue").replace(",",".")):t.length&&(n=t.val(),e=parseFloat(n.replace(",","."))),isNaN(e)?0:e},field_has_inputMask:function(t){var e=!1;return t.each(function(){if(u!==s(this).attr("data-inputmask"))return!(e=!0)}),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===s(this).attr("type"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===s(this).attr("type"))return!(e=!0)}),e},field_is_select:function(t){return t.is("select")},displayErrorMessage:function(t,e){var r=t.closest(".forminator-field--inner"),n=(r=0===r.length?t.closest(".forminator-field"):r).find(".forminator-error-message"),o=t.attr("id")+"-error",i=t.attr("aria-describedby");i?((i=i.split(" ")).includes(o)||i.push(o),i=i.join(" "),t.attr("aria-describedby",i)):t.attr("aria-describedby",o),0===n.length&&(r.append('<span class="forminator-error-message" id="'+o+'"></span>'),n=r.find(".forminator-error-message")),t.attr("aria-invalid","true"),n.html(e),r.addClass("forminator-has_error")},hideErrorMessage:function(t){var e=t.closest(".forminator-field--inner"),r=(e=0===e.length?t.closest(".forminator-field"):e).find(".forminator-error-message"),n=t.attr("id")+"-error",o=t.attr("aria-describedby");o?(o=o.split(" ").filter(function(t){return t!==n}).join(" "),t.attr("aria-describedby",o)):t.removeAttr("aria-describedby"),t.removeAttr("aria-invalid"),r.remove(),e.removeClass("forminator-has_error")}}),s.fn[r]=function(t){return this.each(function(){s.data(this,r)||s.data(this,r,new e(this,t))})}}(jQuery,window,void document),function(a,s){"use strict";var r="forminatorFrontMergeTags",n={print_value:!1,forminatorFields:[]};function e(t,e){this.element=t,this.$el=a(this.element),this.settings=a.extend({},n,e),this._defaults=n,this._name=r,ForminatorFront.MergeTags=ForminatorFront.MergeTags||[],this.init()}a.extend(e.prototype,{init:function(){var r=this,t=this.$el.find(".forminator-merge-tags");const i=this.getFormId();ForminatorFront.MergeTags[i]=ForminatorFront.MergeTags[i]||[],0<t.length&&t.each(function(){let n=a(this).html(),t=a(this).data("field");if(r.$el.hasClass("forminator-grouped-fields")){const o=r.$el.data("suffix");var e;ForminatorFront.MergeTags[i][t]&&(n=ForminatorFront.MergeTags[i][t].value,e=r.$el.find("[name]").map(function(){return this.name}).get(),a.each(e,function(t,e){var r=e.replace("-"+o,"");r!==e&&(r=new RegExp(`{${r}}`,"g"),n=n.replace(r,"{"+e+"}"))})),t+="-"+o}ForminatorFront.MergeTags[i][t]={$input:a(this),value:n}}),this.replaceAll(),this.attachEvents()},getFormId:function(){let t="";return t=(this.$el.hasClass("forminator-grouped-fields")?this.$el.closest("form.forminator-ui"):this.$el).data("form-id")},attachEvents:function(){var t=this;this.$el.find(".forminator-textarea, input.forminator-input, .forminator-checkbox, .forminator-radio, .forminator-input-file, select.forminator-select2, .forminator-multiselect input, input.forminator-slider-hidden, input.forminator-slider-hidden-min, input.forminator-slider-hidden-max").each(function(){a(this).on("change",function(){setTimeout(function(){t.replaceAll()},300)})})},replaceAll:function(){var t=this.getFormId(),e=ForminatorFront.MergeTags[t];for(const n in e){var r=e[n];this.replace(r)}},replace:function(t){var e=t.$input,t=this.maybeReplaceValue(t.value);e.html(t)},maybeReplaceValue:function(t){for(var e=this.settings.forminatorFields.join("|"),r=new RegExp("\\{("+("("+e+")-\\d+")+")(\\-[0-9A-Za-z-_]+)?\\}","g"),n=t;a=r.exec(t);){var o=a[0],i=o.replace("{","").replace("}",""),a=a[2];o!==s&&i!==s&&a!==s&&(a=this.get_field_value(i),n=n.replace(o,a))}return n},get_form_field:function(t){let e=this.$el;var r=(e=e.hasClass("forminator-grouped-fields")?e.closest("form.forminator-ui"):e).find("#"+t+"-field");return r=0===r.length&&0===(r=e.find("[name="+t+"]")).length&&0===(r=e.find('input[name="'+t+'[]"]')).length?e.find("#"+t):r},is_calculation:function(t){return!!this.get_form_field(t).hasClass("forminator-calculation")},get_field_value:function(t){var e=this.get_form_field(t),r=this,n="",o=null;if(this.is_hidden(t)&&!this.is_calculation(t))return"";if(this.is_calculation(t)&&(!this.get_form_field(t).closest(".forminator-col").closest(".forminator-row").hasClass("forminator-hidden-option")&&this.is_hidden(t)))return"";return this.field_is_radio(e)?(o=e.filter(":checked")).length&&(n=this.settings.print_value?o.val():(0===o.siblings(".forminator-radio-label").length?o.siblings(".forminator-screen-reader-only"):o.siblings(".forminator-radio-label")).text()):this.field_is_checkbox(e)?e.each(function(){var t;a(this).is(":checked")&&(""!==n&&(n+=", "),t=!!a(this).closest(".forminator-multiselect").length,r.settings.print_value?n+=a(this).val():n+=(t?a(this).closest("label"):0===a(this).siblings(".forminator-checkbox-label").length?a(this).siblings(".forminator-screen-reader-only"):a(this).siblings(".forminator-checkbox-label")).text())}):this.field_is_select(e)?(o=e.find("option").filter(":selected")).length&&(n=this.settings.print_value?o.val():o.text()):this.field_is_upload(e)?n=e.val().split("\\").pop():this.field_has_inputMask(e)?(e.inputmask({autoUnmask:!1}),n=e.val(),e.inputmask({autoUnmask:!0})):n=e.val(),n},field_has_inputMask:function(t){var e=!1;return t.each(function(){if(s!==a(this).attr("data-inputmask"))return!(e=!0)}),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===a(this).attr("type"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===a(this).attr("type"))return!(e=!0)}),e},field_is_upload:function(t){return"file"===t.attr("type")},field_is_select:function(t){return t.is("select")},is_hidden:function(t){var t=this.get_form_field(t).closest(".forminator-col"),e=t.closest(".forminator-row");return!(!e.hasClass("forminator-hidden-option")&&!e.hasClass("forminator-hidden")&&!t.hasClass("forminator-hidden"))}}),a.fn[r]=function(t){return this.each(function(){a.data(this,r)||a.data(this,r,new e(this,t))})}}(jQuery,(window,void document)),function(s,a,u){"use strict";Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t,e){if(t===u||null===t)throw new TypeError("Cannot convert first argument to object");for(var r=Object(t),n=1;n<arguments.length;n++){var o=arguments[n];if(o!==u&&null!==o)for(var i=Object.keys(Object(o)),a=0,s=i.length;a<s;a++){var l=i[a],f=Object.getOwnPropertyDescriptor(o,l);f!==u&&f.enumerable&&(r[l]=o[l])}}return r}});var r="forminatorFrontPayment",n={type:"stripe",paymentEl:null,paymentRequireSsl:!1,generalMessages:{}};function e(t,e){this.element=t,this.$el=s(this.element),this.settings=s.extend({},n,e),this._defaults=n,this._name=r,this._stripeData=null,this._stripe=null,this._cardElement=null,this._stripeToken=null,this._beforeSubmitCallback=null,this._form=null,this._paymentIntent=null,this.init()}s.extend(e.prototype,{init:function(){var n;this.settings.paymentEl&&void 0!==this.settings.paymentEl.data()&&((n=this)._stripeData=this.settings.paymentEl.data(),!1!==this.mountCardField())&&(s(this.element).on("payment.before.submit.forminator",function(t,e,r){n._form=n.getForm(t),n._beforeSubmitCallback=r,n.validateStripe(t,e)}),this.$el.on("forminator:form:submit:stripe:3dsecurity",function(t,e,r){n.validate3d(t,e,r)}),this.$el.find("input.forminator-input, .forminator-checkbox, .forminator-radio, select.forminator-select2").each(function(){s(this).on("change",function(t){n.mapZip(t)})}))},validate3d:function(t,e,r){var n=this;r?this._stripe.confirmCardPayment(e,{payment_method:{card:n._cardElement,...n.getBillingData()}}).then(function(t){n.$el.find("#forminator-stripe-subscriptionid").val(r),n._beforeSubmitCallback&&n._beforeSubmitCallback.call()}):this._stripe.retrievePaymentIntent(e).then(function(t){"requires_action"!==t.paymentIntent.status&&"requires_source_action"!==t.paymentIntent.status||n._stripe.handleCardAction(e).then(function(t){n._beforeSubmitCallback&&n._beforeSubmitCallback.call()})})},validateStripe:function(r,n){var o=this;this._stripe.createToken(this._cardElement).then(function(t){t.error?(o.showCardError(t.error.message,!0),o.$el.find("button").removeAttr("disabled")):(o.hideCardError(),o._stripe.createPaymentMethod("card",o._cardElement,o.getBillingData()).then(function(t){var e=o.getObjectValue(t,"paymentMethod");o._stripeData.paymentMethod=o.getObjectValue(e,"id"),o.updateAmount(r,n,t)}))})},isValid:function(e){var r=this;this._stripe.createToken(this._cardElement).then(function(t){t.error?r.showCardError(t.error.message,e):r.hideCardError()})},getForm:function(t){t=s(t.target);return t=t.hasClass("forminator-custom-form")?t:t.closest("form.forminator-custom-form")},updateAmount:function(r,n,t){r.preventDefault();var o=this,e=n,t=this.getObjectValue(t,"paymentMethod"),t=(e.append("action","forminator_update_payment_amount"),e.append("paymentid",this.getStripeData("paymentid")),e.append("payment_method",this.getObjectValue(t,"id")),this.getStripeData("receipt")),i=this.getStripeData("receiptEmail");t&&i&&(t=this.get_field_value(i)||"",e.append("receipt_email",t)),s.ajax({type:"POST",url:a.ForminatorFront.ajaxUrl,data:e,cache:!1,contentType:!1,processData:!1,beforeSend:function(){var t;void 0!==o.settings.has_loader&&o.settings.has_loader&&(o._form.addClass("forminator-fields-disabled"),(t=o._form.find(".forminator-response-message")).html("<p>"+o.settings.loader_label+"</p>"),o.focus_to_element(t),t.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-success forminator-error").addClass("forminator-loading forminator-show")),o._form.find("button").attr("disabled",!0)},success:function(t){var e;!0===t.success?void 0!==t.data&&void 0!==t.data.paymentid?(o.$el.find("#forminator-stripe-paymentid").val(t.data.paymentid),o.$el.find("#forminator-stripe-paymentmethod").val(o._stripeData.paymentMethod),o._stripeData.paymentid=t.data.paymentid,o._stripeData.secret=t.data.paymentsecret,o.handleCardPayment(t,r,n)):o.show_error("Invalid Payment Intent ID"):(o.show_error(t.data.message),t.data.errors.length&&o.show_messages(t.data.errors),(t=o._form.find(".forminator-g-recaptcha")).length&&(e=(t=s(t.get(0))).data("forminator-recapchta-widget"),"invisible"===t.data("size"))&&a.grecaptcha.reset(e))},error:function(t){t=400===t.status?a.ForminatorFront.cform.upload_error:a.ForminatorFront.cform.error;o.show_error(t)}})},show_error:function(t){var e=this._form.find(".forminator-response-message");this._form.find("button").removeAttr("disabled"),e.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-loading").addClass("forminator-error forminator-show"),e.html("<p>"+t+"</p>"),this.focus_to_element(e),this.enable_form()},enable_form:function(){var t;void 0!==this.settings.has_loader&&this.settings.has_loader&&(t=this._form.find(".forminator-response-message"),this._form.removeClass("forminator-fields-disabled"),t.removeClass("forminator-loading"))},mapZip:function(t){var e=this.getStripeData("veifyZip"),r=this.getStripeData("zipField"),n=s(t.currentTarget).attr("name");e&&""!==r&&n===r&&t.originalEvent!==u&&(e=this.get_field_value(r),this._cardElement.update({value:{postalCode:e}}))},focus_to_element:function(t){t.show(),s("html,body").animate({scrollTop:t.offset().top-(s(a).height()-t.outerHeight(!0))/2},500,function(){t.attr("tabindex")||t.attr("tabindex",-1),t.focus()})},show_messages:function(t){var o,i=this,a=i.$el.data("forminatorFrontCondition");return void 0!==a&&(this.$el.find(".forminator-error-message").remove(),o=0,t.forEach(function(t){var e,r,n=Object.keys(t),t=Object.values(t),n=a.get_form_field(n);n.length&&(0===o&&(i.$el.trigger("forminator.front.pagination.focus.input",[n]),i.focus_to_element(n)),s(n).hasClass("forminator-input-time")&&(0===(r=(e=s(n).closest(".forminator-field:not(.forminator-field--inner)")).children(".forminator-error-message")).length&&(e.append('<span class="forminator-error-message" aria-hidden="true"></span>'),r=e.children(".forminator-error-message")),r.html(t)),0===(r=(e=0===(e=s(n).closest(".forminator-field--inner")).length&&0===(e=s(n).closest(".forminator-field")).length&&1<(e=s(n).find(".forminator-field")).length?e.first():e).find(".forminator-error-message")).length&&(e.append('<span class="forminator-error-message" aria-hidden="true"></span>'),r=e.find(".forminator-error-message")),s(n).attr("aria-invalid","true"),r.html(t),e.addClass("forminator-has_error"),o++)})),this},getBillingData:function(t){if(!this.getStripeData("billing"))return{};var e=this.getStripeData("billingName"),r=this.getStripeData("billingEmail"),n=this.getStripeData("billingAddress"),o={address:{}},i=(e&&(i=(i=this.get_field_value(e))||(this.get_field_value(e+"-first-name")||"")+" "+(this.get_field_value(e+"-last-name")||""))&&(o.name=i),r&&(e=this.get_field_value(r)||"")&&(o.email=e),this.get_field_value(n+"-street_address")||""),r=(i&&(o.address.line1=i),this.get_field_value(n+"-address_line")||""),e=(r&&(o.address.line2=r),this.get_field_value(n+"-city")||""),i=(e&&(o.address.city=e),this.get_field_value(n+"-state")||"");i&&(o.address.state=i);r=this.get_form_field(n+"-country").find(":selected").data("country-code"),r&&(o.address.country=r),e=this.get_field_value(n+"-zip")||"";return e&&(o.address.postal_code=e),{billing_details:o}},handleCardPayment:function(t,e,r){t.data.paymentsecret;t=s(".forminator-number--field, .forminator-currency, .forminator-calculation");t.inputmask&&t.inputmask("remove"),this._beforeSubmitCallback&&this._beforeSubmitCallback.call()},mountCardField:function(){var t=this.getStripeData("key"),e=this.getStripeData("cardIcon"),r=this.getStripeData("veifyZip"),n=(this.getStripeData("zipField"),this.getStripeData("fieldId"));if(null===t)return!1;this._stripe=Stripe(t,{locale:this.getStripeData("language")});var t={},r=(r?t.value={postalCode:""}:t.hidePostalCode=!0,{}),o=this.getStripeData("fontFamily"),i=this.getStripeData("customFonts"),i=(o&&i&&(r.fonts=[{cssSrc:"https://fonts.bunny.net/css?family="+o}]),this._stripe.elements(r));this._cardElement=i.create("card",Object.assign({classes:{base:this.getStripeData("baseClass"),complete:this.getStripeData("completeClass"),empty:this.getStripeData("emptyClass"),focus:this.getStripeData("focusedClass"),invalid:this.getStripeData("invalidClass"),webkitAutofill:this.getStripeData("autofilledClass")},style:{base:{iconColor:this.getStripeData("iconColor"),color:this.getStripeData("fontColor"),lineHeight:this.getStripeData("lineHeight"),fontWeight:this.getStripeData("fontWeight"),fontFamily:this.getStripeData("fontFamily"),fontSmoothing:"antialiased",fontSize:this.getStripeData("fontSize"),"::placeholder":{color:this.getStripeData("placeholder")},":hover":{iconColor:this.getStripeData("iconColorHover")},":focus":{iconColor:this.getStripeData("iconColorFocus")}},invalid:{iconColor:this.getStripeData("iconColorError"),color:this.getStripeData("fontColorError")}},iconStyle:"solid",hideIcon:!e},t)),this._cardElement.mount("#card-element-"+n),this.validateCard()},validateCard:function(){var e=this;this._cardElement.on("change",function(t){e.$el.find(".forminator-stripe-element").hasClass("StripeElement--empty")?e.$el.find(".forminator-stripe-element").closest(".forminator-field").removeClass("forminator-is_filled"):e.$el.find(".forminator-stripe-element").closest(".forminator-field").addClass("forminator-is_filled"),e.$el.find(".forminator-stripe-element").hasClass("StripeElement--invalid")&&e.$el.find(".forminator-stripe-element").closest(".forminator-field").addClass("forminator-has_error")}),this._cardElement.on("focus",function(t){e.$el.find(".forminator-stripe-element").closest(".forminator-field").addClass("forminator-is_active")}),this._cardElement.on("blur",function(t){e.$el.find(".forminator-stripe-element").closest(".forminator-field").removeClass("forminator-is_active"),e.isValid(!1)})},hideCardError:function(){var t=this.$el.find(".forminator-card-message"),e=t.find(".forminator-error-message");0===e.length&&(t.append('<span class="forminator-error-message" aria-hidden="true"></span>'),e=t.find(".forminator-error-message")),t.closest(".forminator-field").removeClass("forminator-has_error"),e.html("")},showCardError:function(t,e){var r=this.$el.find(".forminator-card-message"),n=r.find(".forminator-error-message");0===n.length&&(r.append('<span class="forminator-error-message" aria-hidden="true"></span>'),n=r.find(".forminator-error-message")),r.closest(".forminator-field").addClass("forminator-has_error"),r.closest(".forminator-field").addClass("forminator-is_filled"),n.html(t),e&&this.focus_to_element(r.closest(".forminator-field"))},getStripeData:function(t){return void 0!==this._stripeData&&void 0!==this._stripeData[t]?this._stripeData[t]:null},getObjectValue:function(t,e){return void 0!==t[e]?t[e]:null},get_form_field:function(t){var e=this.$el.find("#"+t+"-field");return e=0===e.length&&0===(e=this.$el.find("input[name="+t+"]")).length&&0===(e=this.$el.find("textarea[name="+t+"]")).length&&0===(e=this.$el.find('input[name="'+t+'[]"]')).length&&0===(e=this.$el.find('select[name="'+t+'"]')).length?this.$el.find("#"+t):e},get_field_value:function(t){var t=this.get_form_field(t),e="",r=null;return this.field_is_radio(t)?(r=t.filter(":checked")).length&&(e=r.val()):this.field_is_checkbox(t)?t.each(function(){s(this).is(":checked")&&(e=s(this).val())}):e=!this.field_is_select(t)&&this.field_has_inputMask(t)?parseFloat(t.inputmask("unmaskedvalue")):t.val(),e},get_field_calculation:function(t){var t=this.get_form_field(t),e=0,r=0,n=null;return this.field_is_radio(t)?(n=t.filter(":checked")).length&&(r=n.data("calculation"))!==u&&(e=Number(r)):this.field_is_checkbox(t)?t.each(function(){s(this).is(":checked")&&(r=s(this).data("calculation"))!==u&&(e+=Number(r))}):this.field_is_select(t)?(n=t.find("option").filter(":selected")).length&&(r=n.data("calculation"))!==u&&(e=Number(r)):e=Number(t.val()),isNaN(e)?0:e},field_has_inputMask:function(t){var e=!1;return t.each(function(){if(u!==s(this).attr("data-inputmask"))return!(e=!0)}),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===s(this).attr("type"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===s(this).attr("type"))return!(e=!0)}),e},field_is_select:function(t){return t.is("select")}}),s.fn[r]=function(t){return this.each(function(){s.data(this,r)||s.data(this,r,new e(this,t))})}}(jQuery,window,void document),function(s,l){"use strict";var r="forminatorFrontPagination",n={totalSteps:0,step:0,hashStep:0,inline_validation:!1};function e(t,e){this.element=s(t),this.$el=this.element,this.totalSteps=0,this.step=0,this.finished=!1,this.hashStep=!1,this.next_button_txt="",this.prev_button_txt="",this.custom_label=[],this.form_id=0,this.element="",this.settings=s.extend({},n,e),this._defaults=n,this._name=r,this.init()}s.extend(e.prototype,{init:function(){var e=this,t=this.$el.data("draft-page")?this.$el.data("draft-page"):0;this.next_button=this.settings.next_button||l.ForminatorFront.cform.pagination_next,this.prev_button=this.settings.prev_button||l.ForminatorFront.cform.pagination_prev,0<this.$el.find("input[name=form_id]").length&&(this.form_id=this.$el.find("input[name=form_id]").val()),this.totalSteps=this.settings.totalSteps,this.step=this.settings.step,this.quiz=this.settings.quiz,this.element=this.$el.find("[data-step="+this.step+"]").data("name"),this.form_id&&"object"==typeof l.Forminator_Cform_Paginations&&"object"==typeof l.Forminator_Cform_Paginations[this.form_id]&&(this.custom_label=l.Forminator_Cform_Paginations[this.form_id]),0<t?this.go_to(t,!0):this.settings.hashStep&&0<this.step?this.go_to(this.step,!0):this.quiz?this.go_to(0,!0):this.go_to(0,!1),this.render_navigation(),this.render_bar_navigation(),this.render_footer_navigation(this.form_id),this.init_events(),this.update_buttons(),this.update_navigation(),this.$el.find(".forminator-button.forminator-button-back, .forminator-button.forminator-button-next, .forminator-button.forminator-button-submit").on("click",function(t){t.preventDefault(),s(this).trigger("forminator.front.pagination.move"),e.resetRichTextEditorHeight()}),this.$el.on("click",".forminator-result--view-answers",function(t){t.preventDefault(),s(this).trigger("forminator.front.pagination.move")})},init_events:function(){var o=this;this.$el.find(".forminator-button-back").on("forminator.front.pagination.move",function(t){o.handle_click("prev")}),this.$el.on("forminator.front.pagination.move",".forminator-result--view-answers",function(t){o.handle_click("prev")}),this.$el.find(".forminator-button-next").on("forminator.front.pagination.move",function(t){o.handle_click("next")}),this.$el.find(".forminator-step").on("click",function(t){t.preventDefault();t=s(this).data("nav");o.handle_step(t)}),this.$el.on("reset",function(t){o.on_form_reset(t)}),this.$el.on("forminator:quiz:submit:success",function(t,e,r,n){n&&o.move_to_results(t)}),this.$el.on("forminator.front.pagination.focus.input",function(t,e){o.on_focus_input(t,e)})},move_to_results:function(t){this.finished=!0,this.$el.find(".forminator-submit-rightaway").length?this.$el.find("#forminator-submit").removeClass("forminator-hidden"):this.handle_click("next")},on_form_reset:function(t){this.go_to(0,!0),this.update_buttons()},on_focus_input:function(t,e){e=this.get_page_of_input(e);this.go_to(e,!0),this.update_buttons()},render_footer_navigation:function(t){var e="",r=!0===this.custom_label["has-paypal"]?' style="align-items: flex-start;"':"",n=this.$el.find(".forminator-save-draft-link").length?this.$el.find(".forminator-save-draft-link"):"";this.custom_label[this.element]&&"custom"===this.custom_label["pagination-labels"]?(this.prev_button_txt=""!==this.custom_label[this.element]["prev-text"]?this.custom_label[this.element]["prev-text"]:this.prev_button,this.next_button_txt=""!==this.custom_label[this.element]["next-text"]?this.custom_label[this.element]["next-text"]:this.next_button):(this.prev_button_txt=this.prev_button,this.next_button_txt=this.next_button),e=this.$el.hasClass("forminator-design--material")?'<div class="forminator-pagination-footer"'+r+'><button class="forminator-button forminator-button-back"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">'+this.prev_button_txt+'</span></button><button class="forminator-button forminator-button-next"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">'+this.next_button_txt+"</span></button>":'<div class="forminator-pagination-footer"'+r+'><button class="forminator-button forminator-button-back">'+this.prev_button_txt+'</button><button class="forminator-button forminator-button-next">'+this.next_button_txt+"</button>",!0===this.custom_label["has-paypal"]&&(e+='<div class="forminator-payment forminator-button-paypal forminator-hidden '+(this.custom_label["paypal-id"]||"")+'-payment" id="paypal-button-container-'+t+'">'),this.$el.append(e+="</div>"),""!==n&&n.insertBefore(this.$el.find(".forminator-button-next"))},render_bar_navigation:function(){var t=this.$el.find(".forminator-pagination-progress");t.length&&(t.html('<div class="forminator-progress-label">0%</div><div class="forminator-progress-bar"><span style="width: 0%"></span></div>'),this.calculate_bar_percentage())},calculate_bar_percentage:function(){var t=this.totalSteps,e=this.step+1,r=this.$el;r.length&&(e=Math.round(e/t*100),r.find(".forminator-progress-label").html(e+"%"),r.find(".forminator-progress-bar span").css("width",e+"%"))},render_navigation:function(){var n=this.$el.find(".forminator-pagination-steps"),t=this.$el.find(".forminator-pagination-start");if(n.length){const a=s(this.$el).data("forminator-render")||"";var o=this.$el.find(".forminator-pagination").not(".forminator-pagination-start"),i=(n.append('<div class="forminator-break"></div>'),this);o.each(function(){var t=s(this),e=t.data("label"),t=t.data("step")-1,r="forminator-custom-form-"+i.form_id+"-"+a+"--page-"+t;n.append('<button role="tab" id="'+(r+"-label")+'" class="forminator-step forminator-step-'+t+'" aria-selected="false" aria-controls="'+r+'" data-nav="'+t+'"><span class="forminator-step-label">'+e+'</span><span class="forminator-step-dot" aria-hidden="true"></span></button>'+'<div class="forminator-break" aria-hidden="true"></div>')}),t.each(function(){var t=s(this).data("label"),e=o.length,r="forminator-custom-form-"+i.form_id+"--page-"+e;n.append('<button role="tab" id="'+(r+"-label")+'" class="forminator-step forminator-step-'+e+'" data-nav="'+e+'" aria-selected="false" aria-controls="'+r+'"><span class="forminator-step-label">'+t+'</span><span class="forminator-step-dot" aria-hidden="true"></span></button>'+'<div class="forminator-break" aria-hidden="true"></div>')})}},handle_step:function(t){if(this.settings.inline_validation)for(var e=0;e<t;e++)if(this.step<=e&&!this.is_step_inputs_valid(e))return void this.go_to(e,!0);this.go_to(t,!0),this.update_buttons()},handle_click:function(t){var e,r=this;if("prev"===t&&0!==this.step)this.go_to(this.step-1,!0),this.update_buttons();else if("next"===t){if(this.settings.inline_validation&&!this.is_step_inputs_valid(this.step))return;void 0!==this.$el.data().forminatorFrontPayment&&(e=this.$el.data().forminatorFrontPayment,0<this.$el.find("[data-step="+this.step+"]").find(".forminator-stripe-element").not(".forminator-hidden .forminator-stripe-element").length)?e._stripe.createToken(e._cardElement).then(function(t){t.error?e.showCardError(t.error.message,!0):(e.hideCardError(),r.go_to(r.step+1,!0),r.update_buttons())}):(this.go_to(this.step+1,!0),this.update_buttons())}var t=s(this.$el),n=t.find(".forminator-textarea");t.hasClass("forminator-design--material")&&n.length&&n.each(function(){FUI.textareaMaterial(this)})},is_step_inputs_valid:function(t){var r=0,n=this.$el.data("validator"),t=this.$el.find("[data-step="+t+"]");return void 0===n||(t.find("input, select, textarea").not(":submit, :reset, :image, :disabled").not(':hidden:not(.forminator-wp-editor-required, .forminator-input-file-required, input[name$="_data"])').not('[gramm="true"]').each(function(t,e){n.element(e)||(0===r&&e.focus(),r++)}),0===r)},get_page_of_input:function(t){var e=this.step,t=s(t).closest(".forminator-pagination");return e=0<t.length&&void 0!==(t=s(t).data("step"))?+t:e},update_buttons:function(){var t,e,r,n,o,i=this.$el.hasClass("draft-enabled"),a=this,s=(0===this.step?(i||this.$el.find(".forminator-button-back").closest(".forminator-pagination-footer").css({"justify-content":"flex-end"}),this.$el.find(".forminator-button-back").addClass("forminator-hidden"),this.$el.find(".forminator-button-next").removeClass("forminator-hidden")):1<this.totalSteps&&(i||this.$el.find(".forminator-button-back").closest(".forminator-pagination-footer").css({"justify-content":"space-between"}),this.$el.find(".forminator-button-back, .forminator-button-next").removeClass("forminator-hidden")),this.step!==this.totalSteps||this.finished||(this.step--,this.$el.trigger("submit")),this.settings.submitButtonClass);this.step!==this.totalSteps-1||this.finished?(this.element=this.$el.find("[data-step="+this.step+"]").data("name"),this.custom_label[this.element]&&"custom"===this.custom_label["pagination-labels"]?(this.prev_button_txt=""!==this.custom_label[this.element]["prev-text"]?this.custom_label[this.element]["prev-text"]:this.prev_button,this.next_button_txt=""!==this.custom_label[this.element]["next-text"]?this.custom_label[this.element]["next-text"]:this.next_button):(this.prev_button_txt=this.prev_button,this.next_button_txt=this.next_button),this.step===this.totalSteps-1&&this.finished&&(this.next_button_txt=l.ForminatorFront.quiz.view_results),(this.$el.hasClass("forminator-design--material")?(this.$el.find("#forminator-submit").removeAttr("id").removeClass("forminator-button-submit forminator-hidden "+s).addClass("forminator-button-next"),!0===this.custom_label["has-paypal"]&&(this.$el.find("#forminator-paypal-submit").removeAttr("id").addClass("forminator-hidden"),this.$el.find(".forminator-button-next").removeClass("forminator-button-submit forminator-hidden "+s)),this.$el.find(".forminator-button-back .forminator-button--text").html(this.prev_button_txt),this.$el.find(".forminator-button-next .forminator-button--text")):(this.$el.find("#forminator-submit").removeAttr("id").removeClass("forminator-button-submit forminator-hidden").addClass("forminator-button-next"),!0===this.custom_label["has-paypal"]&&(this.$el.find("#forminator-paypal-submit").removeAttr("id").addClass("forminator-hidden"),this.$el.find(".forminator-button-next").removeClass("forminator-button-submit forminator-hidden")),this.$el.find(".forminator-button-back").html(this.prev_button_txt),this.$el.find(".forminator-button-next"))).html(this.next_button_txt),this.step===this.totalSteps&&this.finished&&this.$el.find(".forminator-button-next, .forminator-button-back").addClass("forminator-hidden")):(t=this.$el.find(".forminator-pagination-submit").html(),e=this.$el.find(".forminator-pagination-submit").data("loading"),i="custom"===this.custom_label["pagination-labels"]&&""!==this.custom_label["last-previous"]?this.custom_label["last-previous"]:this.prev_button,r=a.$el.find(".forminator-payment"),n=this.$el.find(".forminator-button-next"),o=this.$el.find(".forminator-button-submit"),this.$el.hasClass("forminator-design--material")?(this.$el.find(".forminator-button-back .forminator-button--text").html(i),n.removeClass("forminator-button-next").attr("id","forminator-submit"),setTimeout(function(){n.addClass("forminator-button-submit "+s).find(".forminator-button--text").html("").html(t).data("loading",e)},20)):(this.$el.find(".forminator-button-back").html(i),n.removeClass("forminator-button-next").attr("id","forminator-submit"),setTimeout(function(){n.addClass("forminator-button-submit "+s).html(t).data("loading",e)},20)),setTimeout(function(){o=a.$el.find(".forminator-button-submit")},30),this.$el.hasClass("forminator-quiz")&&!t&&(o.addClass("forminator-hidden"),this.$el.find(".forminator-submit-rightaway").length)&&o.html(l.ForminatorFront.quiz.view_results),!0===this.custom_label["has-paypal"]&&(r.attr("id","forminator-paypal-submit"),setTimeout(function(){l.paypalHasCondition.includes(a.$el.data("form-id"))||(o.addClass("forminator-hidden"),r.removeClass("forminator-hidden"))},40)),0<r.find("iframe").length&&r.find("iframe").width("100%")),this.$el.trigger("forminator.front.condition.restart")},go_to:function(t,e){if((this.step=t)===this.totalSteps&&!this.finished)return!1;this.$el.find(".forminator-pagination").css({height:"0",opacity:"0",visibility:"hidden"}).attr("aria-hidden","true").attr("hidden",!0),this.$el.find(".forminator-pagination .forminator-pagination--content").hide(),this.$el.find("[data-step="+t+"]").css({height:"auto",opacity:"1",visibility:"visible"}).removeAttr("aria-hidden").removeAttr("hidden"),this.$el.find("[data-step="+t+"] .forminator-pagination--content").show();t=this.$el.data("forminatorFront");void 0!==t&&t.responsive_captcha(),this.update_navigation(),e&&this.scroll_to_top_form()},update_navigation:function(){this.$el.find(".forminator-current").attr("aria-selected","false"),this.$el.find(".forminator-current").removeClass("forminator-current"),this.$el.find(".forminator-step-"+this.step).attr("aria-selected","true"),this.$el.find(".forminator-step-"+this.step).addClass("forminator-current"),this.$el.find(".forminator-pagination:not(:hidden)").find(".forminator-answer input").first().trigger("change"),this.calculate_bar_percentage()},scroll_to_top_form:function(){var t,e=this.$el,r=this.$el.find(".forminator-row").not(":hidden").first();(e=r.length?r:e).length&&(r="html,body",0<this.$el.closest(".sui-dialog").length&&(r=".sui-dialog"),0<this.$el.closest(".wph-modal").length&&(r=".wph-modal"),e.focus(),t=e.offset().top-(s(l).height()-e.outerHeight(!0))/2,this.quiz&&(t=e.offset().top,s("#wpadminbar").length)&&(t-=35),s(r).animate({scrollTop:t},500,function(){e.attr("tabindex")||e.attr("tabindex",-1)}))},resetRichTextEditorHeight:function(){var e;"undefined"!=typeof tinyMCE&&(e=this.$el).find(".forminator-textarea").each(function(){var t=s(this).attr("id");0!==e.find("#"+t+"_ifr").length&&e.find("#"+t+"_ifr").is(":visible")&&e.find("#"+t+"_ifr").height(s(this).height())})}}),s.fn[r]=function(t){return this.each(function(){s.data(this,r)||s.data(this,r,new e(this,t))})}}(jQuery,window,document),function(l,e,o){"use strict";var r="forminatorFrontPayPal",n={type:"paypal",paymentEl:null,paymentRequireSsl:!1,generalMessages:{}};function i(t,e){this.element=t,this.$el=l(this.element),this.forminator_selector="#"+this.$el.attr("id")+'[data-forminator-render="'+this.$el.data("forminator-render")+'"]',this.settings=l.extend({},n,e),this._defaults=n,this._name=r,this.paypalData=null,this.paypalButton=null,this.init()}l.extend(i.prototype,{init:function(){this.settings.paymentEl&&(this.paypalData=this.settings.paymentEl,this.render_paypal_button(this.element),this.replaceScriptCurrency())},is_data_valid:function(){var t=this.configurePayPal(),e=this.settings.paymentRequireSsl;return!(t.amount<=0||e&&"https:"!==location.protocol)},is_form_valid:function(){var t=this.$el.validate(),e=t.checkForm();return t.submitted={},e},render_paypal_button:function(t){var i=l(t),a=this,r=this.configurePayPal(),n=i.find(".forminator-response-message"),s=ForminatorFront.cform.gateway.error,e=this.settings.paymentRequireSsl,o=this.settings.generalMessages,t={shape:r.shape,color:r.color,label:r.label,layout:r.layout,height:parseInt(r.height)};"vertical"!==r.layout&&(t.tagline=r.tagline),this.paypalButton=paypal.Buttons({onInit:function(t,e){e.disable(),"variable"===r.amount_type&&""!==r.variable&&(r.amount=a.get_field_calculation(r.variable)),i.find("input, select, textarea, .forminator-field-signature").on("change",function(){a.is_data_valid()&&a.is_form_valid()?(e.enable(),n.hasClass("forminator-error")&&(n.html("").attr("aria-hidden","true"),n.removeClass("forminator-show"))):e.disable()}),i.on("validation:error",function(){e.disable()}),i.on("forminator:uploads:valid",function(){a.is_data_valid()&&a.is_form_valid()&&e.enable()}),a.is_data_valid()&&a.is_form_valid()&&e.enable()},env:r.mode,style:t,onClick:function(){if(!i.valid()&&r.amount<=0)n.removeClass("forminator-accessible").addClass("forminator-error").html("").removeAttr("aria-hidden"),n.html('<label class="forminator-label--error"><span>'+o.payment_require_amount_error+"</span></label>"),a.focus_to_element(n);else if(e&&"https:"!==location.protocol)n.removeClass("forminator-accessible").addClass("forminator-error").html("").removeAttr("aria-hidden"),n.html('<label class="forminator-label--error"><span>'+o.payment_require_ssl_error+"</span></label>"),a.focus_to_element(n);else if(i.valid()){if(i.trigger("forminator:preSubmit:paypal",[n]),n.html())return a.focus_to_element(n),!1}else n.removeClass("forminator-accessible").addClass("forminator-error").html("").removeAttr("aria-hidden"),n.html('<label class="forminator-label--error"><span>'+o.form_has_error+"</span></label>"),a.focus_to_element(n);"variable"===r.amount_type&&""!==r.variable&&(r.amount=a.get_field_calculation(r.variable))},createOrder:function(t,e){i.addClass("forminator-partial-disabled");var r=i.find('input[name="forminator_nonce"]').val(),n=a.getPayPalData("form_id"),o=a.paypal_request_data();return fetch(ForminatorFront.ajaxUrl+"?action=forminator_pp_create_order",{method:"POST",mode:"same-origin",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({nonce:r,form_id:n,mode:a.getPayPalData("mode"),form_data:o,form_fields:i.serialize()})}).then(function(t){return t.json()}).then(function(t){return!0!==t.success?(s=t.data,!1):(t=t.data.order_id,i.find(".forminator-paypal-input").val(t),t)})},onApprove:function(t,e){void 0!==a.settings.has_loader&&a.settings.has_loader&&(i.addClass("forminator-fields-disabled"),n.html("<p>"+a.settings.loader_label+"</p>"),n.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-success forminator-error").addClass("forminator-loading forminator-show"),a.focus_to_element(n)),i.trigger("submit.frontSubmit")},onCancel:function(t,e){return void 0!==a.settings.has_loader&&a.settings.has_loader&&(i.removeClass("forminator-fields-disabled forminator-partial-disabled"),n.removeClass("forminator-loading")),e.redirect()},onError:function(){void 0!==a.settings.has_loader&&a.settings.has_loader&&(i.removeClass("forminator-fields-disabled forminator-partial-disabled"),n.removeClass("forminator-loading")),n.removeClass("forminator-accessible").addClass("forminator-error").html("").removeAttr("aria-hidden"),n.html('<label class="forminator-label--error"><span>'+s+"</span></label>"),a.focus_to_element(n)}}),this.paypalButton.render(i.find(".forminator-button-paypal")[0])},configurePayPal:function(){var t={form_id:this.getPayPalData("form_id"),sandbox_id:this.getPayPalData("sandbox_id"),currency:this.getPayPalData("currency"),live_id:this.getPayPalData("live_id"),amount:0},e=(t.color=this.getPayPalData("color")?this.getPayPalData("color"):"gold",t.shape=this.getPayPalData("shape")?this.getPayPalData("shape"):"rect",t.label=this.getPayPalData("label")?this.getPayPalData("label"):"checkout",t.layout=this.getPayPalData("layout")?this.getPayPalData("layout"):"vertical",t.tagline=this.getPayPalData("tagline")?this.getPayPalData("tagline"):"true",t.redirect_url=this.getPayPalData("redirect_url")?this.getPayPalData("redirect_url"):"",t.mode=this.getPayPalData("mode"),t.locale=this.getPayPalData("locale")?this.getPayPalData("locale"):"en_US",t.debug_mode=this.getPayPalData("debug_mode")?this.getPayPalData("debug_mode"):"disable",t.amount_type=this.getPayPalData("amount_type")?this.getPayPalData("amount_type"):"fixed",t.variable=this.getPayPalData("variable")?this.getPayPalData("variable"):"",t.height=this.getPayPalData("height")?this.getPayPalData("height"):55,t.shipping_address=this.getPayPalData("shipping_address")?this.getPayPalData("shipping_address"):55,this.getPayPalData("amount_type"));return"fixed"===e?t.amount=this.getPayPalData("amount"):"variable"===e&&""!==t.variable&&(t.amount=this.get_field_calculation(t.variable)),t},getPayPalData:function(t){return void 0!==this.paypalData[t]?this.paypalData[t]:null},get_form_field:function(t){var e=this.$el.find("#"+t+"-field");return e=0===e.length&&0===(e=this.$el.find("input[name="+t+"]")).length&&0===(e=this.$el.find("textarea[name="+t+"]")).length&&0===(e=this.$el.find('input[name="'+t+'[]"]')).length&&0===(e=this.$el.find('select[name="'+t+'"]')).length&&0===(e=this.$el.find("#"+t)).length?this.$el.find("select[name="+t+"]"):e},get_field_calculation:function(t){var t=this.get_form_field(t),e=0,r=0,n=null;return this.field_is_radio(t)?(n=t.filter(":checked")).length&&(r=n.data("calculation"))!==o&&(e=Number(r)):this.field_is_checkbox(t)?t.each(function(){l(this).is(":checked")&&(r=l(this).data("calculation"))!==o&&(e+=Number(r))}):this.field_is_select(t)?(n=t.find("option").filter(":selected")).length&&(r=n.data("calculation"))!==o&&(e=Number(r)):e=t.inputmask?t.inputmask("unmaskedvalue").replace(/,/g,"."):Number(t.val()),isNaN(e)?0:e},focus_to_element:function(t){t.show(),l("html,body").animate({scrollTop:t.offset().top-(l(e).height()-t.outerHeight(!0))/2},500,function(){t.attr("tabindex")||t.attr("tabindex",-1),t.focus()})},paypal_request_data:function(){var t=this.configurePayPal(),e=this.getPayPalData("shipping_address"),r=this.getPayPalData("billing-details"),n=this.getBillingData(),o={};return o.purchase_units=[{amount:{currency_code:this.getPayPalData("currency"),value:t.amount}}],"disable"===e&&(o.application_context={shipping_preference:"NO_SHIPPING"}),r&&(o.payer=n),o},getBillingData:function(){var t,e,r,n,o,i=this.getPayPalData("billing-name"),a=this.getPayPalData("billing-email"),s=this.getPayPalData("billing-address"),l={};return i&&(l.name={},(n=this.get_field_value(i))||(t=this.get_field_value(i+"-prefix")||"",e=this.get_field_value(i+"-first-name")||"",r=this.get_field_value(i+"-middle-name")||"",o=this.get_field_value(i+"-last-name")||"",n=(n=t?t+" ":"")+e+(r?" "+r:"")),n)&&(l.name.given_name=n,l.name.surname=o),a&&(i=this.get_field_value(a)||"")&&(l.email_address=i),s&&(l.address={},(t=this.get_field_value(s+"-street_address")||"")&&(l.address.address_line_1=t),(e=this.get_field_value(s+"-address_line")||"")&&(l.address.address_line_2=e),(r=this.get_field_value(s+"-city")||"")&&(l.address.admin_area_2=r),(n=this.get_field_value(s+"-state")||"")&&(l.address.admin_area_1=n),(o=this.get_form_field(s+"-country")||"")&&(l.address.country_code=o.find(":selected").data("country-code")),a=this.get_field_value(s+"-zip")||"")&&(l.address.postal_code=a),l},get_field_value:function(t){var t=this.get_form_field(t),e="",r=null;return this.field_is_radio(t)?(r=t.filter(":checked")).length&&(e=r.val()):this.field_is_checkbox(t)?t.each(function(){l(this).is(":checked")&&(e=l(this).val())}):e=(this.field_is_select(t),t.val()),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===l(this).attr("type"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===l(this).attr("type"))return!(e=!0)}),e},field_is_select:function(t){return t.is("select")},replaceScriptCurrency:function(){var o=this,i=this.paypalData.currency;o.$el.on("click",function(t){var e=l("script[src^='https://www.paypal.com/sdk/js']"),r=e.attr("src"),n=/currency=([^&]+)/.exec(r)[1];i!==n&&(e.attr("src",r.replace("currency="+n,"currency="+i)),o.paypalButton.updateProps())})}}),l.fn[r]=function(t){return this.each(function(){l.data(this,r)||l.data(this,r,new i(this,t))})}}(jQuery,window,void document),function(v){"use strict";var r="forminatorFrontDatePicker",n={};function e(t,e){this.element=t,this.$el=v(this.element),this.settings=v.extend({},n,e),this._defaults=n,this._name=r,this.init()}v.extend(e.prototype,{init:function(){var i=this,t=this.$el.data("format"),e=(this.$el.data("restrict-type"),this.$el.data("restrict")),r=this.$el.data("restrict"),n=this.$el.data("start-year"),o=this.$el.data("end-year"),a=this.$el.data("past-dates"),s=this.$el.val(),l=this.$el.data("start-of-week"),f=this.$el.data("start-date"),u=this.$el.data("end-date"),c=this.$el.data("start-field"),d=this.$el.data("end-field"),m=this.$el.data("start-offset"),h=this.$el.data("end-offset"),p=this.$el.data("disable-date"),b=this.$el.data("disable-range"),r=!isNaN(parseFloat(r))&&isFinite(r)?[r.toString()]:e.split(","),p=p.split(","),b=b.split(","),n=n||"c-95",o=o||"c+95",y=this.$el.closest(".forminator-custom-form"),g="forminator-calendar";y.hasClass("forminator-design--default")?g="forminator-calendar--default":y.hasClass("forminator-design--material")?g="forminator-calendar--material":y.hasClass("forminator-design--flat")?g="forminator-calendar--flat":y.hasClass("forminator-design--bold")&&(g="forminator-calendar--bold"),this.$el.datepicker({beforeShow:function(t,e){var r,n,o=v(this).closest(".elementor-popup-modal");e.dpDiv.removeClass(function(t,e){return(e.match(/\bhustle-\S+/g)||[]).join(" ")}),e.dpDiv.removeClass(function(t,e){return(e.match(/\bforminator-\S+/g)||[]).join(" ")}),e.dpDiv.addClass("forminator-custom-form-"+y.data("form-id")+" "+g),"disable"===a?v(this).datepicker("option","minDate",s):v(this).datepicker("option","minDate",null),f&&(r=new Date(f.replace(/-/g,"/").replace(/T.+/,"")),v(this).datepicker("option","minDate",r)),u&&(r=new Date(u.replace(/-/g,"/").replace(/T.+/,"")),v(this).datepicker("option","maxDate",r)),c&&void 0!==(r=i.getLimitDate(c,m))&&v(this).datepicker("option","minDate",r),d&&void 0!==(r=i.getLimitDate(d,h))&&v(this).datepicker("option","maxDate",r),o.length?(o.append(v("#ui-datepicker-div")),n=t.getBoundingClientRect(),setTimeout(function(){e.dpDiv.css({top:n.top+n.height,left:n.left})},0)):v("body").append(v("#ui-datepicker-div"))},beforeShowDay:function(t){return i.restrict_date(r,p,b,t)},monthNames:datepickerLang.monthNames,monthNamesShort:datepickerLang.monthNamesShort,dayNames:datepickerLang.dayNames,dayNamesShort:datepickerLang.dayNamesShort,dayNamesMin:datepickerLang.dayNamesMin,changeMonth:!0,changeYear:!0,dateFormat:t,yearRange:n+":"+o,minDate:new Date(n,0,1),maxDate:new Date(o,11,31),firstDay:l,onClose:function(){v(this).valid()}}),v(".ui-datepicker").addClass("notranslate")},getLimitDate:function(t,e){var r=v('input[name ="'+t+'"]').val();if(void 0!==r)return t=v('input[name ="'+t+'"]').data("format").replace(/y/g,"yy"),e=e.split("_"),r=moment(r,t.toUpperCase()),r="-"===e[0]?r.subtract(e[1],e[2]):r.add(e[1],e[2]),t=moment(r).format("YYYY-MM-DD"),new Date(t)},restrict_date:function(t,e,r,n){var o=!0,i=n.getDay(),a=jQuery.datepicker.formatDate("mm/dd/yy",n);if(0!==r[0].length)for(var s=0;s<r.length;s++){var l=r[s].split("-"),f=new Date(l[0].trim()),l=new Date(l[1].trim());if(f<=n&&n<=l){o=!1;break}}return-1!==t.indexOf(i.toString())||-1!==e.indexOf(a)||!1===o?[!1,"disabledDate"]:[!0,"enabledDate"]}}),v.fn[r]=function(t){return this.each(function(){v.data(this,r)||v.data(this,r,new e(this,t))})}}(jQuery,(window,document)),function(m){"use strict";var r="forminatorFrontValidate",n={},o={rules:{},messages:{}};function e(t,e){this.element=t,this.$el=m(this.element),this.settings=m.extend({},o,e),this._defaults=o,this._name=r,this.init()}function i(t){t=String(t).trim();var e=parseFloat(t);return String(e)===t?a(e,2):1===(e=t.split(/[^\dE-]+/)).length?a(parseFloat(t),2):(t=e.pop(),a(parseFloat(e.join("")+"."+t),2))}function a(t,e){return(Math.floor(100*t)/100).toFixed(e)}function s(t){var[t,e]=t.split(" "),[t,r]=t.split(":");return(t=60*(t=void 0!==e&&(12===parseInt(t,10)&&(t=0),"pm"===e.toLowerCase())?parseInt(t,10)+12:t)*60)+(r*=60)}m.extend(e.prototype,{init:function(){m(".forminator-select2").on("change",this.element,function(t,e){"forminator_emulate_trigger"!==e&&m(this).trigger("focusout")});var r=!1,o=this.$el,i=this.settings.rules,a=this.settings.messages;if(o.hasClass("forminator-grouped-fields")){let n=o.data("suffix");m.each(i,function(t,e){var r=t.replace(/(.+?)(\[\])?$/g,"$1-"+n+"$2");(o.find('[name="'+r+'"]').length||o.find("#"+r.replace("[]","")).length)&&(i[r]=e,a[r]=a[t])}),o=o.closest("form.forminator-ui")}o.data("validator",null).unbind("validate").validate({ignore:":hidden:not(.do-validate)",errorPlacement:function(t,e){o.trigger("validation:error")},showErrors:function(t,e){r&&0<e.length&&(o.find(".forminator-response-message").html("<ul></ul>"),jQuery.each(e,function(t,e){o.find(".forminator-response-message ul").append("<li>"+e.message+"</li>")}),o.find(".forminator-response-message").removeAttr("aria-hidden").prop("tabindex","-1").addClass("forminator-accessible")),r=!1,this.defaultShowErrors(),o.trigger("validation:showError",e)},invalidHandler:function(t,e){r=!0,o.trigger("validation:invalid")},onfocusout:function(t){!1===m(t).hasClass("hasDatepicker")&&m(t).valid(),m(t).trigger("validation:focusout")},highlight:function(t,e,r){var n=m(t),o=n.closest(".forminator-field"),i=n.closest(".forminator-date-input"),a=n.closest(".forminator-timepicker"),s=!1,l=!1,f=!1,t=this.errorMap[t.name],u=n.attr("id")+"-error",c=n.attr("aria-describedby"),d='<span class="forminator-error-message" id="'+u+'"></span>';(0<i.length?(l=(s=i.parent()).find('.forminator-error-message[data-error-field="'+n.data("field")+'"]'),f=s.find(".forminator-description"),d='<span class="forminator-error-message" data-error-field="'+n.data("field")+'" id="'+u+'"></span>',0===l.length&&("day"===n.data("field")&&(s.find('.forminator-error-message[data-error-field="year"]').length?m(d).insertBefore(s.find('.forminator-error-message[data-error-field="year"]')):0===f.length?s.append(d):m(d).insertBefore(f),0===o.find(".forminator-error-message").length)&&o.append('<span class="forminator-error-message" id="'+u+'"></span>'),"month"===n.data("field")&&(s.find('.forminator-error-message[data-error-field="day"]').length?m(d).insertBefore(s.find('.forminator-error-message[data-error-field="day"]')):0===f.length?s.append(d):m(d).insertBefore(f),0===o.find(".forminator-error-message").length)&&o.append('<span class="forminator-error-message" id="'+u+'"></span>'),"year"===n.data("field"))&&(0===f.length?s.append(d):m(d).insertBefore(f),0===o.find(".forminator-error-message").length)&&o.append('<span class="forminator-error-message" id="'+u+'"></span>'),s.find('.forminator-error-message[data-error-field="'+n.data("field")+'"]').html(t),o.find(".forminator-error-message")):0<a.length?(l=(s=a.parent()).find('.forminator-error-message[data-error-field="'+n.data("field")+'"]'),f=s.find(".forminator-description"),d='<span class="forminator-error-message" data-error-field="'+n.data("field")+'" id="'+u+'"></span>',0===l.length&&("hours"===n.data("field")&&(s.find('.forminator-error-message[data-error-field="minutes"]').length?m(d).insertBefore(s.find('.forminator-error-message[data-error-field="minutes"]')):0===f.length?s.append(d):m(d).insertBefore(f),0===o.find(".forminator-error-message").length)&&o.append('<span class="forminator-error-message" id="'+u+'"></span>'),"minutes"===n.data("field"))&&(0===f.length?s.append(d):m(d).insertBefore(f),0===o.find(".forminator-error-message").length)&&o.append('<span class="forminator-error-message" id="'+u+'"></span>'),s.find('.forminator-error-message[data-error-field="'+n.data("field")+'"]').html(t),o.find(".forminator-error-message")):(l=o.find(".forminator-error-message"),f=o.find(".forminator-description"),0===l.length&&(0===f.length?o.append(d):m(d).insertBefore(f)),o.find(".forminator-error-message"))).html(t),c?((i=c.split(" ")).includes(u)||i.push(u),a=i.join(" "),n.attr("aria-describedby",a)):n.attr("aria-describedby",u),n.attr("aria-invalid","true"),o.addClass("forminator-has_error"),n.trigger("validation:highlight")},unhighlight:function(t,e,r){var t=m(t),n=t.closest(".forminator-field"),o=t.closest(".forminator-timepicker"),i=t.closest(".forminator-date-input"),a="",s=t.attr("id")+"-error",l=t.attr("aria-describedby"),a=0<i.length?i.parent().find('.forminator-error-message[data-error-field="'+t.data("field")+'"]'):0<o.length?o.parent().find('.forminator-error-message[data-error-field="'+t.data("field")+'"]'):n.find(".forminator-error-message");l?(i=l.split(" ").filter(function(t){return t!==s}).join(" "),t.attr("aria-describedby",i)):t.removeAttr("aria-describedby"),t.removeAttr("aria-invalid"),a.remove(),n.removeClass("forminator-has_error"),t.trigger("validation:unhighlight")},rules:i,messages:a}),o.off("forminator.validate.signature").on("forminator.validate.signature",function(){m(this).validate().form()}),m(".time-minutes.has-time-limiter, .time-ampm.has-time-limiter").on("change",function(){m(this).closest(".forminator-col").siblings(".forminator-col").first().find(".time-hours").trigger("focusout")}),m('.forminator-field.required input[type="checkbox"]').on("input",function(){m(this).not(":checked").trigger("focusout")})}}),m.fn[r]=function(t){return m.each(n,function(t,e){void 0===m.validator.methods[t]?m.validator.addMethod(t,e):"number"===t&&(m.validator.methods.number=n.number)}),this.each(function(){m.data(this,r)||m.data(this,r,new e(this,t))})},m.validator.addMethod("validurl",function(t,e){var r=m.validator.methods.url.bind(this);return r(t,e)||r("http://"+t,e)}),m.validator.addMethod("forminatorPhoneNational",function(t,e){var r=m(e);return!r.data("required")&&t==="+"+r.intlTelInput("getSelectedCountryData").dialCode||(void 0===r.data("country")||r.data("country").toLowerCase()===r.intlTelInput("getSelectedCountryData").iso2)&&(this.optional(e)||r.intlTelInput("isValidNumber"))}),m.validator.addMethod("forminatorPhoneInternational",function(t,e){return!m(e).data("required")&&t==="+"+m(e).intlTelInput("getSelectedCountryData").dialCode+" "||this.optional(e)||m(e).intlTelInput("isValidNumber")}),m.validator.addMethod("dateformat",function(t,e,r){var n,o,i,a,s=!1,l="yy-mm-dd"===r||"yy/mm/dd"===r||"yy.mm.dd"===r?/^\d{4}-\d{1,2}-\d{1,2}$/:/^\d{1,2}-\d{1,2}-\d{4}$/;return t=t.replace(/[ /.]/g,"-"),s=!!l.test(t)&&("dd/mm/yy"===r||"dd-mm-yy"===r||"dd.mm.yy"===r?(n=t.split("-"),o=parseInt(n[0],10),i=parseInt(n[1],10),a=parseInt(n[2],10)):"mm/dd/yy"===r||"mm.dd.yy"===r||"mm-dd-yy"===r?(n=t.split("-"),i=parseInt(n[0],10),o=parseInt(n[1],10),a=parseInt(n[2],10)):(n=t.split("-"),a=parseInt(n[0],10),i=parseInt(n[1],10),o=parseInt(n[2],10)),(l=new Date(Date.UTC(a,i-1,o,12,0,0,0))).getUTCFullYear()===a)&&l.getUTCMonth()===i-1&&l.getUTCDate()===o,this.optional(e)||s}),m.validator.addMethod("maxwords",function(t,e,r){return this.optional(e)||t.trim().split(/\s+/).length<=r}),m.validator.methods.maxlength=function(t,e,r){return!((t=t.replace(/<[^>]*>/g,"")).length>r)},m.validator.addMethod("trim",function(t,e,r){return!0===this.optional(e)||0!==t.trim().length}),m.validator.addMethod("emailWP",function(t,e,r){if(!this.optional(e)){if(t.trim().length<6)return!1;if(t.indexOf("@",1)<0)return!1;e=t.split("@",2);if(!e[0].match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~\.-]+$/))return!1;if(e[1].match(/\.{2,}/))return!1;var n=e[1].split(".");if(n.length<2)return!1;for(var o=n.length,i=0;i<o;i++)if(!n[i].match(/^[a-z0-9-]+$/i))return!1}return!0}),m.validator.addMethod("forminatorPasswordStrength",function(t,e,r){var n,t=t.trim();return 0==t.length||!(!t||t.length<8)&&(n=0,t.match(/[0-9]/)&&(n+=10),t.match(/[a-z]/)&&(n+=20),t.match(/[A-Z]/)&&(n+=20),t.match(/[^a-zA-Z0-9]/)&&(n+=30),t.match(/[=!\-@.,_*#&?^`%$+\/{\[\]|}^?~]/)&&(n+=30),54<=Math.log(Math.pow(n,t.length))/Math.LN2)}),m.validator.addMethod("extension",function(t,e,r){var n,o=!1;return""!==t.trim()&&(n=(n=t.replace(/^.*\./,""))==t?"notExt":n.toLowerCase(),-1!=r.indexOf(n))&&(o=!0),this.optional(e)||o}),m.validator.methods.number=function(t,e,r){return this.optional(e)||/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/.test(t)},m.validator.addMethod("minNumber",function(t,e,r){return 0===t.length||r<=i(t)}),m.validator.addMethod("maxNumber",function(t,e,r){return 0===t.length||i(t)<=r}),m.validator.addMethod("timeLimit",function(t,e,r){var t=function(t,e){var r,n,o,i="";t.name.includes("hours")&&(t=m(t).closest(".forminator-col"),r=e,e=t.next(),n=("select"===(n=e.find(".time-minutes")).prop("tagName").toLowerCase()?e.find(".time-minutes option:selected"):e.find(".time-minutes")).val(),o=e.next().find('select[name$="ampm"] option:selected').val());{if(void 0===r||""===r||void 0===n||""===n)return!0;i=r+":"+n}""!==i&&void 0!==o&&(i+=" "+o);return i=s(i)}(e,t),n=s(r.start_limit),r=s(r.end_limit),n=n<=t&&t<=r,o=m(e).closest(".forminator-col").next().find(".forminator-field");return n||!0===t?o.removeClass("forminator-has_error"):setTimeout(function(){o.addClass("forminator-has_error")},10),!0===t||n}),n=m.validator.methods}(jQuery,(window,document)),function(i,u,e,o){"use strict";u.paypalHasCondition=[];var n="forminatorFrontCondition",a={fields:{},relations:{}};function r(t,e,r){this.element=t,this.$el=i(this.element),this.settings=i.extend({},a,e),this._defaults=a,this._name=n,this.calendar=r[0],this.init()}i.extend(r.prototype,{init:function(){var n=this,o=this.$el,t=this.$el.find(".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea, .forminator-field-signature");if(o.hasClass("forminator-grouped-fields")){let r=o.data("suffix");i.each(this.settings.fields,function(t,e){t=t+"-"+r;(o.find('[name="'+t+'"]').length||o.find("#"+t).length)&&(e=n.updateConditions(e,r,o),n.settings.fields[t]=e)})}this.add_missing_relations(),t.on("change input forminator.change",function(t){var e=i(this),r=e.closest(".forminator-col").attr("id");if(!e.is('input[type="radio"]')||"input"!==t.type)return r=(r=void 0!==r&&0!==r.indexOf("slider-")?r:"1"===e.attr("data-multi")||"hidden"===e.attr("type")?e.attr("name"):e.attr("id")).trim(),!(!n.has_relations(r)&&!n.has_siblings(r))&&(n.has_siblings(r)&&n.trigger_fake_parent_date_field(r),!n.has_relations(r)&&n.has_siblings(r)?(n.trigger_siblings(r),!1):(n.process_relations(r,e,t),n.paypal_button_condition(),void n.maybe_clear_upload_container()))}),i(e).on("tinymce-editor-init",function(t,e){e.on("change",function(t){o.find("#"+i(this).attr("id")).change()})}),"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&tinyMCE.activeEditor.on("change",function(t){o.find("#"+i(this).attr("id")).change()}),this.$el.find(".forminator-button.forminator-button-back, .forminator-button.forminator-button-next").on("click",function(){o.find('.forminator-field input:not([type="file"]), .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea').trigger("forminator.change","forminator_emulate_trigger")}),this.$el.find(".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea").trigger("forminator.change","forminator_emulate_trigger"),this.init_events()},updateConditions:function(t,e,r){t=JSON.parse(JSON.stringify(t));if(t.conditions&&Array.isArray(t.conditions)){const n=r.closest(".forminator-col").prop("id");t.conditions.forEach(function(t){t.field&&t.group&&t.group===n&&(t.field=t.field+"-"+e)})}return t},process_relations:function(t,s,l){var f=this;f.get_relations(t).forEach(function(t){var e,r=f.get_field_logic(t),n=r.action,o=r.rule,i=r.conditions,a=0;0!==t.indexOf("paypal")||0===r.length||u.paypalHasCondition.includes(f.$el.data("form-id"))||u.paypalHasCondition.push(f.$el.data("form-id")),i.forEach(function(t){f.is_applicable_rule(t,n)&&a++}),"all"===o&&a===i.length||"any"===o&&0<a?(s instanceof jQuery&&(e=s.closest(".forminator-pagination")),"submit"===t&&void 0!==e&&f.toggle_field(t,"show","valid"),f.toggle_field(t,n,"valid"),f.has_relations(t)&&("hide"===n?f.hide_element(t,l):f.show_element(t,l))):(f.toggle_field(t,n,"invalid"),f.has_relations(t)&&("show"===n?f.hide_element(t,l):f.show_element(t,l)))})},init_events:function(){var e=this;this.$el.on("forminator.front.condition.restart",function(t){e.on_restart(t)})},on_restart:function(t){this.$el.find('.forminator-field input:not([type="file"]), .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea').trigger("change","forminator_emulate_trigger")},add_missing_relations:function(){var t,n=this,o={};void 0!==this.settings.fields&&(t=this.settings.fields,Object.keys(t).forEach(function(r){t[r].conditions.forEach(function(t){var e,t=t.field;n.has_relations(t)?(e=n.get_relations(t),-1===i.inArray(r,e)&&n.settings.relations[t].push(r)):(void 0===o[t]&&(o[t]=[]),o[t].push(r))})})),Object.keys(o).forEach(function(t){n.settings.relations[t]=o[t]})},get_field_logic:function(t){return void 0===this.settings.fields[t]?[]:this.settings.fields[t]},has_relations:function(t){return void 0!==this.settings.relations[t]},get_relations:function(t){return this.has_relations(t)?i.unique(this.settings.relations[t]):[]},get_field_value:function(t){var e;return""!==t&&(t=this.get_form_field(t),e=t.val(),this.field_is_radio(t)?e=t.filter(":checked").val():this.field_is_signature(t)?e=t.find("input[id$='_data']").val():this.field_is_checkbox(t)?(e=[],t.each(function(){i(this).is(":checked")&&e.push(i(this).val().toLowerCase())}),0===e.length&&(e=null)):this.field_is_textarea_wpeditor(t)?"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&(e=tinyMCE.activeEditor.getContent()):this.field_has_inputMask(t)&&(e=parseFloat(t.inputmask("unmaskedvalue").replace(",","."))),e)||""},get_date_field_value:function(t){if(""===t)return"";var e=this.get_form_field(t),r=!0,n="";if(!(r=e instanceof jQuery&&(r=!1,e.hasClass("forminator-col"))?!0:r)&&this.field_is_datepicker(e)){switch(n=e.val(),e.data("format")){case"dd/mm/yy":n=e.val().split("/").reverse().join("-");break;case"dd.mm.yy":n=e.val().split(".").reverse().join("-");break;case"dd-mm-yy":n=e.val().split("-").reverse().join("-")}var o=new Date,n={year:(o=""!==n?new Date(n):o).getFullYear(),month:o.getMonth(),date:o.getDate(),day:o.getDay()}}else{var r=!0===r?t:e.data("parent"),t=this.get_form_field_value(r+"-year"),i=this.get_form_field_value(r+"-month"),r=this.get_form_field_value(r+"-day");""!==t&&""!==i&&""!==r&&(n={year:(o=new Date(t+"-"+i+"-"+r)).getFullYear(),month:o.getMonth(),date:o.getDate(),day:o.getDay()})}return n||""},field_has_inputMask:function(t){var e=!1;return t.each(function(){if(o!==i(this).attr("data-inputmask"))return!(e=!0)}),e},field_is_radio:function(t){var e=!1;return t.each(function(){if("radio"===i(this).attr("type"))return!(e=!0)}),e},field_is_signature:function(t){var e=!1;return t.each(function(){if(0<i(this).find(".forminator-field-signature").length)return!(e=!0)}),e},field_is_datepicker:function(t){var e=!1;return t.each(function(){if(i(this).hasClass("forminator-datepicker"))return!(e=!0)}),e},field_is_checkbox:function(t){var e=!1;return t.each(function(){if("checkbox"===i(this).attr("type"))return!(e=!0)}),e},field_is_select:function(t){return t.is("select")},field_is_textarea_wpeditor:function(t){var e=!1;return t.each(function(){if(i(this).parent(".wp-editor-container").parent("div").hasClass("tmce-active"))return!(e=!0)}),e},field_is_upload:function(t){var e=!1;return e=-1!==t.indexOf("upload")?!0:e},get_form_field:function(t){let e=this.$el;var r=(e=e.hasClass("forminator-grouped-fields")?e.closest("form.forminator-ui"):e).find("#"+t+"-field");return r=0===r.length&&0===(r=e.find("."+t+"-payment")).length&&0===(r=e.find('input[name="'+t+'"]')).length&&0===(r=e.find('textarea[name="'+t+'"]')).length&&0===(r=e.find('input[name="'+t+'[]"]')).length&&0===(r=e.find('select[name="'+t+'"]')).length?e.find("#"+t):r},get_form_field_value:function(t){var e=this.$el.data("form-id"),r=this.$el.data("uid"),e=this.$el.find("#forminator-form-"+e+"__field--"+t+"_"+r);return(e=0===e.length&&0===(e=this.$el.find("#"+t+"-field")).length&&0===(e=this.$el.find('input[name="'+t+'"]')).length&&0===(e=this.$el.find('textarea[name="'+t+'"]')).length&&0===(e=this.$el.find('input[name="'+t+'[]"]')).length&&0===(e=this.$el.find('select[name="'+t+'"]')).length?this.$el.find("#"+t):e).val()},is_numeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},is_date_rule:function(t){return["day_is","day_is_not","month_is","month_is_not","is_before","is_after","is_before_n_or_more_days","is_before_less_than_n_days","is_after_n_or_more_days","is_after_less_than_n_days"].includes(t)},has_siblings:function(t){return""!==t&&!!(t=this.get_form_field(t)).data("parent")},trigger_fake_parent_date_field:function(t){t=this.get_form_field(t).data("parent");this.process_relations(t,{},{})},trigger_siblings:function(r){var n=this,t=n.get_form_field(r).data("parent");i.each([t+"-year",t+"-month",t+"-day"],function(t,e){r!==e&&n.has_relations(e)&&n.get_form_field(e).trigger("change")})},is_applicable_rule:function(t,e){var r,n,o;return void 0!==t&&(r=this.is_date_rule(t.operator)?this.get_date_field_value(t.field):this.get_field_value(t.field),n=t.value,o=t.operator,"show"===e?this.is_matching(r,n,o)&&this.is_hidden(t.field):this.is_matching(r,n,o))},is_hidden:function(t){t=this.get_form_field(t).closest(".forminator-col").closest(".forminator-row");return!!t.hasClass("forminator-hidden-option")||!t.hasClass("forminator-hidden")},is_matching:function(t,e,r){var n,o=Array.isArray(t);switch("string"==typeof t&&(t=t.toLowerCase()),"string"==typeof e&&(e=e.toLowerCase(),"month_is"!==r&&"month_is_not"!==r||i.inArray(e,n={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11})&&(e=n[e]),"day_is"!==r&&"day_is_not"!==r||i.inArray(e,n={su:0,mo:1,tu:2,we:3,th:4,fr:5,sa:6})&&(e=n[e])),r){case"is":return o?-1<i.inArray(e,t):this.is_numeric(t)&&this.is_numeric(e)?Number(t)===Number(e):t===e;case"is_not":return o?-1===i.inArray(e,t):t!==e;case"is_great":return e=+e,!(!this.is_numeric(t=+t)||!this.is_numeric(e))&&e<t;case"is_less":return e=+e,!(!this.is_numeric(t=+t)||!this.is_numeric(e))&&t<e;case"contains":return this.contains(t,e);case"starts":return t.startsWith(e);case"ends":return t.endsWith(e);case"month_is":return t.month===e;case"month_is_not":return t.month!==e;case"day_is":return t.day===e;case"day_is_not":return t.day!==e;case"is_before":return this.date_is_smaller(t,e);case"is_after":return this.date_is_grater(t,e);case"is_before_n_or_more_days":return this.date_is_n_days_before_current_date(t,e);case"is_before_less_than_n_days":return this.date_is_less_than_n_days_before_current_date(t,e);case"is_after_n_or_more_days":return this.date_is_n_days_after_current_date(t,e);case"is_after_less_than_n_days":return this.date_is_less_than_n_days_after_current_date(t,e)}return!1},contains:function(t,e){return 0<=t.toLowerCase().indexOf(e)},date_is_grater:function(t,e){return 1===forminatorDateUtil.compare(t,e)},date_is_smaller:function(t,e){return-1===forminatorDateUtil.compare(t,e)},date_is_equal:function(t,e){return 0===forminatorDateUtil.compare(t,e)},date_is_n_days_before_current_date:function(t,e){e=parseInt(e);var r=this.get_current_date(),t=forminatorDateUtil.diffInDays(t,r);return!isNaN(t)&&(0===e?t===e:e<=t)},date_is_less_than_n_days_before_current_date:function(t,e){e=parseInt(e);var r=this.get_current_date(),t=forminatorDateUtil.diffInDays(t,r);return!isNaN(t)&&t<e&&0<t},date_is_n_days_after_current_date:function(t,e){e=parseInt(e);var r=this.get_current_date(),r=forminatorDateUtil.diffInDays(r,t);return!isNaN(r)&&(0===e?r===e:e<=r)},date_is_less_than_n_days_after_current_date:function(t,e){e=parseInt(e);var r=this.get_current_date(),r=forminatorDateUtil.diffInDays(r,t);return!isNaN(r)&&r<e&&0<r},get_current_date:function(){return new Date},toggle_field:function(t,e,r){var n=this,o=this.get_form_field(t),i=o.closest(".forminator-col"),a=i.find(".forminator-input-file-required"),s=i.find("[id ^=ctlSignature][id $=_data]"),l=i.find(".forminator-wp-editor-required"),f=i.closest(".forminator-row"),u=this.$el.find(".forminator-pagination-footer").find(".forminator-button-next"),c=this.$el.find("submit"===t?".forminator-button-submit":"#forminator-paypal-submit");"show"===e&&("valid"===r?(f.removeClass("forminator-hidden"),i.removeClass("forminator-hidden"),u.removeClass("forminator-hidden"),0<a.length&&a.addClass("do-validate"),0<l.length&&l.addClass("do-validate"),0<s.length&&s.addClass("do-validate"),setTimeout(function(){"submit"===t&&c.removeClass("forminator-hidden"),0===t.indexOf("paypal")&&(n.$el.find(".forminator-button-submit").addClass("forminator-hidden"),c.removeClass("forminator-hidden"))},100)):(i.addClass("forminator-hidden"),setTimeout(function(){"submit"===t&&c.addClass("forminator-hidden"),0===t.indexOf("paypal")&&(n.$el.find(".forminator-button-submit").removeClass("forminator-hidden"),c.addClass("forminator-hidden"))},100),0<a.length&&a.removeClass("do-validate"),0<l.length&&l.removeClass("do-validate"),0<s.length&&s.removeClass("do-validate"),0===f.find("> .forminator-col:not(.forminator-hidden)").length&&f.addClass("forminator-hidden"))),"hide"===e&&("valid"===r?(i.addClass("forminator-hidden"),c.addClass("forminator-hidden"),0<a.length&&a.removeClass("do-validate"),0<l.length&&l.removeClass("do-validate"),0<s.length&&s.removeClass("do-validate"),0===f.find("> .forminator-col:not(.forminator-hidden)").length&&f.addClass("forminator-hidden"),setTimeout(function(){"submit"===t&&c.addClass("forminator-hidden"),0===t.indexOf("paypal")&&(n.$el.find(".forminator-button-submit").removeClass("forminator-hidden"),c.addClass("forminator-hidden"))},100)):(f.removeClass("forminator-hidden"),i.removeClass("forminator-hidden"),c.removeClass("forminator-hidden"),0<a.length&&a.addClass("do-validate"),0<l.length&&l.addClass("do-validate"),0<s.length&&s.addClass("do-validate"),setTimeout(function(){"submit"===t&&c.removeClass("forminator-hidden"),0===t.indexOf("paypal")&&(n.$el.find(".forminator-button-submit").addClass("forminator-hidden"),c.removeClass("forminator-hidden"))},100))),this.$el.trigger("forminator:field:condition:toggled"),this.toggle_confirm_password(o)},clear_value:function(t,e){var r=this.get_form_field(t),n=this.get_field_value(t);r.hasClass("forminator-cleared-value")||(r.addClass("forminator-cleared-value"),e.originalEvent!==o&&(this.field_is_radio(r)?(r.attr("data-previous-value",n),r.removeAttr("checked")):this.field_is_checkbox(r)?r.each(function(){i(this).attr("data-previous-value",n),i(this).prop("checked",!1)}):(r.attr("data-previous-value",n),r.val(""))))},restore_value:function(t,e){var r=this.get_form_field(t),n=r.attr("data-previous-value");r.hasClass("forminator-cleared-value")&&e.originalEvent!==o&&(r.removeClass("forminator-cleared-value"),!this.field_is_upload(t))&&n&&(this.field_is_radio(r)?r.val([n]):this.field_is_checkbox(r)?r.each(function(){var t=i(this).attr("data-previous-value");t&&0<=t.indexOf(i(this).val().toLowerCase())&&i(this).prop("checked",!0)}):r.val(n))},hide_element:function(t,r){var n=this,e=n.get_relations(t);n.clear_value(t,r),e.forEach(function(t){var e="hide"===n.get_field_logic(t).action?"show":"hide";n.toggle_field(t,e,"valid"),n.has_relations(t)&&("hide"==e?n.hide_element(t,r):n.show_element(t,r))})},show_element:function(t,i){var a=this,s=a.get_relations(t);this.restore_value(t,i),this.textareaFix(this.$el,t,i),s.forEach(function(t){var e=a.get_field_logic(t),r=e.action,n=e.rule,e=e.conditions,o=0;e.forEach(function(t){a.is_applicable_rule(t,r)&&o++}),"all"===n&&o===e.length||"any"===n&&0<o?a.toggle_field(t,r,"valid"):a.toggle_field(t,r,"invalid"),a.has_relations(t)&&(s=a.show_element(t,i))})},paypal_button_condition:function(){var t=this.$el.find(".forminator-paypal-row"),e=this.$el.find(".forminator-pagination-footer").find(".forminator-button-paypal");0<t.length&&(this.$el.find(".forminator-button-submit").closest(".forminator-row").removeClass("forminator-hidden"),t.hasClass("forminator-hidden")||this.$el.find(".forminator-button-submit").closest(".forminator-row").addClass("forminator-hidden")),0<e.length&&(e.hasClass("forminator-hidden")?this.$el.find(".forminator-button-submit").removeClass("forminator-hidden"):this.$el.find(".forminator-button-submit").addClass("forminator-hidden"))},maybe_clear_upload_container:function(){this.$el.find('.forminator-row.forminator-hidden input[type="file"]').each(function(){""===i(this).val()&&(i(this).parent().hasClass("forminator-multi-upload")?i(this).parent().siblings(".forminator-uploaded-files").empty():(i(this).siblings("span").text(i(this).siblings("span").data("empty-text")),i(this).siblings(".forminator-button-delete").hide()))})},textareaFix:function(t,e,r){var n=i("#"+e+" .forminator-label");e.includes("textarea")&&t.hasClass("forminator-design--material")&&0<n.length&&(t=i("#"+e+" .forminator-textarea"),e=n.height()+9,n.css({"padding-top":e+"px"}),t.css({"padding-top":e+"px"}))},toggle_confirm_password:function(t){0!==t.length&&t.attr("id")&&-1!==t.attr("id").indexOf("password")&&((t=t.closest(".forminator-col")).hasClass("forminator-hidden")?t.parent(".forminator-row").next(".forminator-row").addClass("forminator-hidden"):t.parent(".forminator-row").next(".forminator-row").removeClass("forminator-hidden"))}}),i.fn[n]=function(t,e){return this.each(function(){i.data(this,n)||i.data(this,n,new r(this,t,e))})}}(jQuery,window,document),function(p,b,y){"use strict";var r="forminatorFrontSubmit",n={form_type:"custom-form",forminatorFront:!1,forminator_selector:"",chart_design:"bar",chart_options:{}};function e(t,e){this.element=t,this.$el=p(this.element),this.forminatorFront=null,this.settings=p.extend({},n,e),this._defaults=n,this._name=r,this.init()}p.extend(e.prototype,{init:function(){switch(this.forminatorFront=this.$el.data("forminatorFront"),this.settings.form_type){case"custom-form":this.settings.forminator_selector&&p(this.settings.forminator_selector).length||(this.settings.forminator_selector=".forminator-custom-form"),this.handle_submit_custom_form();break;case"quiz":this.settings.forminator_selector&&p(this.settings.forminator_selector).length||(this.settings.forminator_selector=".forminator-quiz"),this.handle_submit_quiz();break;case"poll":this.settings.forminator_selector&&p(this.settings.forminator_selector).length||(this.settings.forminator_selector=".forminator-poll"),this.handle_submit_poll()}},decodeHtmlEntity:function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(e)})},removeCountryCode:function(t){t.find(".forminator-field--phone").each(function(){var t=p(this);t.data("required")||"international"!==t.data("validation")?t.data("required")||"standard"!==t.data("validation")||"+"+t.intlTelInput("getSelectedCountryData").dialCode===t.val()&&t.val(""):"+"+t.intlTelInput("getSelectedCountryData").dialCode+" "===t.val()&&t.val("")})},handle_submit_custom_form:function(){var c=this,d=c.$el.find(".forminator-save-draft-link"),r=(c.$el.find(".forminator-response-message").find(".forminator-label--success").not(":hidden").length&&c.focus_to_element(c.$el.find(".forminator-response-message")),p(".def-ajaxloader").hide(),!1);p("body").on("click","#lostPhone",function(t){t.preventDefault();var e=p(this);!1===r&&(r=!0,p.ajax({type:"GET",url:e.attr("href"),beforeSend:function(){e.attr("disabled","disabled"),p(".def-ajaxloader").show()},success:function(t){e.removeAttr("disabled"),p(".def-ajaxloader").hide(),p(".notification").text(t.data.message),r=!1}}))}),p("body").on("click",".auth-back",function(t){t.preventDefault();t=c.$el.attr("id");p("#"+(t+"-authentication")+"-input").attr("disabled","disabled"),FUI.closeAuthentication()}),0!==d.length&&this.handle_submit_form_draft(),p("body").off("forminator:preSubmit:paypal",this.settings.forminator_selector).on("forminator:preSubmit:paypal",this.settings.forminator_selector,function(t,e){return c.processCaptcha(c,t,e)}),p("body").off("submit.frontSubmit",this.settings.forminator_selector),p("body").on("submit.frontSubmit",this.settings.forminator_selector,function(r,t){if(!c.$el.find(".forminator-button-submit").prop("disabled"))if(c.disable_form_submit(c,!0),0!==c.$el.find('input[type="hidden"][value="forminator_submit_preview_form_custom-forms"]').length)c.disable_form_submit(c,!1);else{var e,s=p(this),n=this,o=r,l=new FormData(this),f=s.find(".forminator-response-message"),i="true"===c.$el.find('input[name="save_draft"]').val(),a=p("body").find("#ui-datepicker-div.forminator-custom-form-"+c.$el.data("form-id"));if(c.removeCountryCode(s),c.settings.inline_validation&&0<c.$el.find(".forminator-uploaded-files").length&&!i)if(0<c.$el.find(".forminator-uploaded-files li.forminator-has_error").length)return c.disable_form_submit(c,!1),!1;if(o.originalEvent!==y){var u=p(this).find(".forminator-button-submit").first();if(0===u.length||p(u).closest(".forminator-col").hasClass("forminator-hidden"))return c.disable_form_submit(c,!1),!1}0!==a.length&&c.$el.datepicker("widget").is(":visible")?c.disable_form_submit(c,!1):c.$el.data("forminatorFrontPayment")&&!i&&(s.find(".forminator-button-submit").attr("disabled",!0),!1===c.processCaptcha(c,r,f))?(s.find(".forminator-button-submit").attr("disabled",!1),c.disable_form_submit(c,!1)):(c.multi_upload_disable(s,!0),e=function(){var t=c.$el.find(".forminator-pagination:visible"),e=!!t.length,t=t.index(".forminator-pagination");if(l=new FormData(this),i&&e&&l.append("draft_page",t),!c.$el.data("forminatorFrontPayment")&&!i&&!1===c.processCaptcha(c,r,f))return c.disable_form_submit(c,!1),!1;c.$el.hasClass("forminator_ajax")||i?(f.html(""),c.$el.find(".forminator-button-submit").addClass("forminator-button-onload"),c.$el.find("input[type=file]").each(function(){""===p(this).val()&&"function"==typeof b.FormData.prototype.delete&&l.delete(p(this).attr("name"))}),void 0!==c.settings.has_loader&&c.settings.has_loader&&("login"!==c.$el.find('input[name="form_type"]').val()&&c.$el.addClass("forminator-fields-disabled"),f.html("<p>"+c.settings.loader_label+"</p>"),c.focus_to_element(f),f.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-success forminator-error forminator-accessible").addClass("forminator-loading forminator-show")),r.preventDefault(),p.ajax({type:"POST",url:b.ForminatorFront.ajaxUrl,data:l,cache:!1,contentType:!1,processData:!1,beforeSend:function(){s.find("button").attr("disabled",!0),s.trigger("before:forminator:form:submit",l)},success:function(t){var e,r,n,o,i,a;return!t&&void 0!==t||"object"!=typeof t.data?(s.find("button").removeAttr("disabled"),f.addClass("forminator-error").html("<p>"+b.ForminatorFront.cform.error+"<br>("+t.data+")</p>"),c.focus_to_element(f),t.data&&s.trigger("forminator:form:submit:failed",[l,t.data]),!1):t.success&&y!==t.data.type&&"save_draft"===t.data.type?(c.showDraftLink(t.data),!1):(s.find(".forminator-error-message").not(".forminator-uploaded-files .forminator-error-message").remove(),s.find(".forminator-field").removeClass("forminator-has_error"),s.find("button").removeAttr("disabled"),f.html("").removeClass("forminator-accessible forminator-error forminator-success"),c.settings.hasLeads&&void 0!==t.data.entry_id?(c.showQuiz(c.$el),p("#forminator-module-"+c.settings.quiz_id+" input[name=entry_id]").val(t.data.entry_id),"end"===c.settings.form_placement&&p("#forminator-module-"+c.settings.quiz_id).submit(),!1):void 0===t||void 0===t.data||void 0===t.data.authentication||"show"!==t.data.authentication&&"invalid"!==t.data.authentication?(a=t.success?"forminator-success":"forminator-error",void 0!==t.message?(f.removeAttr("aria-hidden").prop("tabindex","-1").addClass(a+" forminator-show"),c.focus_to_element(f,!1,t.fadeout,t.fadeout_time),f.html(t.message),!t.data.success&&t.data.errors.length&&(o='<ul class="forminator-screen-reader-only">',p.each(t.data.errors,function(t,e){for(var r in e)e.hasOwnProperty(r)&&(o+="<li>"+e[r]+"</li>")}),o+="</ul>",f.append(o))):void 0!==t.data&&(i=!0,(i=void 0!==t.data.url&&void 0!==t.data.newtab&&"newtab_thankyou"!==t.data.newtab?!1:i)&&(f.removeAttr("aria-hidden").prop("tabindex","-1").addClass(a+" forminator-show"),c.focus_to_element(f,!1,t.data.fadeout,t.data.fadeout_time),f.html(t.data.message)),!t.data.success&&void 0!==t.data.errors&&t.data.errors.length&&(o='<ul class="forminator-screen-reader-only">',p.each(t.data.errors,function(t,e){for(var r in e)e.hasOwnProperty(r)&&(o+="<li>"+e[r]+"</li>")}),o+="</ul>",f.append(o)),void 0!==t.data.stripe3d)&&(void 0!==t.data.subscription?s.trigger("forminator:form:submit:stripe:3dsecurity",[t.data.secret,t.data.subscription]):s.trigger("forminator:form:submit:stripe:3dsecurity",[t.data.secret,!1])),t.data.success||(i=void 0!==t.data.errors&&t.data.errors.length?t.data.errors:"",s.trigger("forminator:form:submit:failed",[l,i]),c.multi_upload_disable(s,!1),i&&c.show_messages(i)),void(!0===t.success&&(a=void 0!==t.data.behav&&"behaviour-hide"===t.data.behav,s[0]&&(c.settings.resetEnabled&&!a&&s[0].reset(),c.$el.trigger("forminator:field:condition:toggled"),s.find(".forminator-field-signature img").trigger("click"),void 0!==t.data.select_field&&p.each(t.data.select_field,function(r,t){0<t.length&&p.each(t,function(t,e){e.value&&("multiselect"===e.type?s.find("#"+r+" input[value="+e.value+"]").closest(".forminator-option"):s.find("#"+r+" option[value="+e.value+"]")).remove().trigger("change")})}),s.find(".forminator-button-delete").hide(),s.find(".forminator-file-upload input").val(""),s.find(".forminator-file-upload > span").html(b.ForminatorFront.cform.no_file_chosen),s.find("ul.forminator-uploaded-files").html(""),c.$el.find("ul.forminator-uploaded-files").html(""),c.$el.find(".forminator-multifile-hidden").val(""),0<s.find(".forminator-select").length&&s.find(".forminator-select").each(function(t,e){var r=p(e).data("default-value");""===r&&(r=p(e).val()),p(e).val(r).trigger("fui:change")}),s.find(".multiselect-default-values").each(function(){var t=""!==p(this).val()?p.parseJSON(p(this).val()):[],r=Object.values(t);p(this).closest(".forminator-multiselect").find('input[type="checkbox"]').each(function(t,e){-1!==p.inArray(p(e).val(),r)?(p(e).prop("checked",!0),p(e).closest("label").addClass("forminator-is_checked")):(p(e).prop("checked",!1),p(e).closest("label").removeClass("forminator-is_checked"))})}),c.multi_upload_disable(s,!1),s.trigger("forminator:form:submit:success",l),s.trigger("forminator.front.condition.restart")),void 0!==t.data.url&&(void 0!==t.data.newtab&&"sametab"!==t.data.newtab?("newtab_hide"===t.data.newtab&&c.$el.hide(),b.open(c.decodeHtmlEntity(decodeURIComponent(t.data.url)),"_blank")):b.location.href=c.decodeHtmlEntity(decodeURIComponent(t.data.url))),a)&&(c.$el.find(".forminator-row").hide(),c.$el.find(".forminator-pagination-steps").hide(),c.$el.find(".forminator-pagination-footer").hide(),c.$el.find(".forminator-pagination-steps, .forminator-pagination-progress").hide()))):(i=c.$el.attr("id"),e=p("#"+(a=i+"-authentication")),r=p("#"+a+"-input"),n=p("#"+a+"-token"),e.find(".forminator-authentication-notice").removeClass("error"),e.find(".lost-device-url").attr("href",t.data.lost_url),"show"===t.data.authentication&&(c.$el.find(".forminator-authentication-nav").html("").append(t.data.auth_nav),c.$el.find(".forminator-authentication-box").hide(),"fallback-email"===t.data.auth_method&&(c.$el.find(".wpdef-2fa-email-resend input").click(),c.$el.find(".notification").hide()),c.$el.find("#forminator-2fa-"+t.data.auth_method).show(),c.$el.find(".forminator-authentication-box input").attr("disabled",!0),c.$el.find("#forminator-2fa-"+t.data.auth_method+" input").attr("disabled",!1),c.$el.find(".forminator-2fa-link").show(),c.$el.find("#forminator-2fa-link-"+t.data.auth_method).hide(),r.removeAttr("disabled").val(t.data.auth_method),n.val(t.data.auth_token),FUI.openAuthentication(a,i,a+"-input")),"invalid"===t.data.authentication&&(e.find(".forminator-authentication-notice").addClass("error"),e.find(".forminator-authentication-notice").html("<p>"+t.data.message+"</p>"),s.trigger("forminator:form:submit:failed",[l,t.data.message])),!1))},error:function(t){0!==d.length&&(c.$el.find('input[name="save_draft"]').val("false"),d.addClass("disabled")),s.find("button").removeAttr("disabled"),f.html("");t=400===t.status?b.ForminatorFront.cform.upload_error:b.ForminatorFront.cform.error;f.html('<label class="forminator-label--notice"><span>'+t+"</span></label>"),c.focus_to_element(f),s.trigger("forminator:form:submit:failed",[l,t]),c.multi_upload_disable(s,!1)},complete:function(t,e){c.$el.find(".forminator-button-submit").removeClass("forminator-button-onload"),s.trigger("forminator:form:submit:complete",l),c.showLeadsLoader(c)}}).always(function(){void 0!==c.settings.has_loader&&c.settings.has_loader&&(c.$el.removeClass("forminator-fields-disabled forminator-partial-disabled"),f.removeClass("forminator-loading")),0!==d.length&&(c.$el.find('input[name="save_draft"]').val("false"),d.addClass("disabled")),c.disable_form_submit(c,!1),s.trigger("after:forminator:form:submit",l)})):(void 0!==c.settings.has_loader&&c.settings.has_loader&&(c.$el.addClass("forminator-fields-disabled"),f.html("<p>"+c.settings.loader_label+"</p>"),f.removeAttr("aria-hidden").prop("tabindex","-1").removeClass("forminator-success forminator-error forminator-accessible").addClass("forminator-loading forminator-show")),o.currentTarget.submit(),c.showLeadsLoader(c))},u=c.$el.find('div[data-is-payment="true"]').closest(".forminator-row, .forminator-col").hasClass("forminator-hidden"),!c.$el.data("forminatorFrontPayment")||u||i?e.apply(n):c.$el.trigger("payment.before.submit.forminator",[l,function(){e.apply(n)}]))}return!1})},handle_submit_form_draft:function(){p("body").on("click",".forminator-save-draft-link",function(t){t.preventDefault(),t.stopPropagation();var t=p(this).closest("form"),e=t.find('input[name="save_draft"]');t.closest("#forminator-modal").hasClass("preview")||"true"===e.val()||p(this).hasClass("disabled")||(e.val("true"),t.trigger("submit.frontSubmit","draft_submit"))})},showDraftLink:function(t){var e=this.$el;e.trigger("forminator:form:draft:success",t),e.find(".forminator-response-message").html(""),e.hide(),p(t.message).insertBefore(e),this.sendDraftLink(t)},sendDraftLink:function(t){var l=this,t="#send-draft-link-form-"+t.draft_id;p("body").on("submit",t,function(t){var r=p(this),e=new FormData(this),n=r.find("#email-1"),o=n.find(".forminator-field"),i=r.find(".forminator-button-submit"),a=r.find(".forminator-response-message"),s=r.prev(".forminator-draft-email-response");if(p(this).hasClass("submitting")||p(this).hasClass("forminator-has_error")&&""===n.find('input[name="email-1"]').val())return!1;r.addClass("submitting"),i.attr("disabled",!0),r.removeClass("forminator-has_error"),o.removeClass("forminator-has_error"),o.find(".forminator-error-message").remove(),t.preventDefault(),p.ajax({type:"POST",url:b.ForminatorFront.ajaxUrl,data:e,cache:!1,contentType:!1,processData:!1,beforeSend:function(){r.trigger("before:forminator:draft:email:submit",e)},success:function(t){var e=t.data;if(!t&&void 0!==t||"object"!=typeof e)return i.removeAttr("disabled"),a.addClass("forminator-error").html("<p>"+b.ForminatorFront.cform.error+"<br>("+e+")</p>"),l.focus_to_element(a),!1;t.success||y===e.field||"email-1"!==e.field||o.hasClass("forminator-has_error")||(r.addClass("forminator-has_error"),o.addClass("forminator-has_error"),o.append('<span class="forminator-error-message" aria-hidden="true">'+e.message+"</span>")),t.success&&(e.draft_mail_sent?s.removeClass("draft-error").addClass("draft-success"):s.removeClass("draft-success").addClass("draft-error"),s.html(e.draft_mail_message),s.show(),r.hide())},error:function(t){r.removeClass("submitting"),i.removeAttr("disabled")}}).always(function(){r.removeClass("submitting"),i.removeAttr("disabled")}),s.on("click",".draft-resend-mail",function(t){t.preventDefault(),s.slideUp(50),r.show()})})},processCaptcha:function(t,e,r){if((n=t.$el.find(".forminator-g-recaptcha, .forminator-hcaptcha")).length){var n,o=(n=p(n.get(0))).data("size"),i=n.parent(".forminator-col");if(n.hasClass("forminator-g-recaptcha")){var a=n.data("forminator-recapchta-widget");if(0!==n.children().length){var s=b.grecaptcha.getResponse(a);if("invisible"===o&&0===s.length)return b.grecaptcha.execute(a),!1;t.$el.hasClass("forminator_ajax")&&"forminator:preSubmit:paypal"!==e.type&&b.grecaptcha.reset(a)}}else if(n.hasClass("forminator-hcaptcha")){a=n.data("forminator-hcaptcha-widget"),s=hcaptcha.getResponse(a);if("invisible"===o&&0===s.length)return hcaptcha.execute(a),!1;t.$el.hasClass("forminator_ajax")&&"forminator:preSubmit:paypal"!==e.type&&hcaptcha.reset(a)}if(r.html(""),n.hasClass("error")&&n.removeClass("error"),!s||0===s.length)return n.hasClass("error")||n.addClass("error"),r.removeAttr("aria-hidden").html('<label class="forminator-label--error"><span>'+b.ForminatorFront.cform.captcha_error+"</span></label>"),t.settings.inline_validation?i.hasClass("forminator-has_error")||"invisible"===n.data("size")||(i.addClass("forminator-has_error").append('<span class="forminator-error-message" aria-hidden="true">'+b.ForminatorFront.cform.captcha_error+"</span>"),t.focus_to_element(i)):t.focus_to_element(r),!1}},hideForm:function(t){t.css({height:0,opacity:0,overflow:"hidden",visibility:"hidden","pointer-events":"none",margin:0,padding:0,border:0,display:"none"})},showForm:function(t){t.css({height:"",opacity:"",overflow:"",visibility:"","pointer-events":"",margin:"",padding:"",border:"",display:"block"})},showQuiz:function(t){var e=p("#forminator-module-"+this.settings.quiz_id),r=p("#forminator-quiz-leads-"+this.settings.quiz_id);this.hideForm(t),r.find(".forminator-lead-form-skip").hide(),void 0!==this.settings.form_placement&&"beginning"===this.settings.form_placement&&(this.showForm(e),e.find(".forminator-pagination").length)&&(r.find(".forminator-quiz-intro").hide(),e.prepend('<button class="forminator-button forminator-quiz-start forminator-hidden"></button>').find(".forminator-quiz-start").trigger("click").remove())},handle_submit_quiz:function(t){var d=this,u=void 0!==d.settings.hasLeads&&d.settings.hasLeads,m=void 0!==d.settings.leads_id?d.settings.leads_id:0,h=void 0!==d.settings.quiz_id?d.settings.quiz_id:0;p("body").on("submit.frontSubmit",this.settings.forminator_selector,function(t){if(0===d.$el.find('input[type="hidden"][value="forminator_submit_preview_form_quizzes"]').length){var e,r=p(this),n=new FormData(this),o=r.find(".forminator-answer"),i=d.$el.find(".forminator-button").last(),a=d.$el.find(".forminator-quiz--result"),s=i.data("loading"),l=void 0!==d.settings.form_placement?d.settings.form_placement:"",f=void 0!==d.settings.skip_form?d.settings.skip_form:"";if(t.preventDefault(),t.stopPropagation(),d.$el.find(".forminator-has-been-disabled").removeAttr("disabled"),e=r.serialize(),d.$el.find(".forminator-has-been-disabled").attr("disabled","disabled"),u){t="";if(0<d.$el.find("input[name=entry_id]").length&&(t=d.$el.find("input[name=entry_id]").val()),"end"===l&&""===t)return d.showForm(p("#forminator-module-"+m)),a.addClass("forminator-hidden"),p("#forminator-quiz-leads-"+h+" .forminator-lead-form-skip").show(),!1;if(!f&&""===t)return!1}""!==s&&i.text(s),d.settings.has_quiz_loader&&o.each(function(){var t=p(this),e=t.find("input"),t=t.find(".forminator-answer--status");e.is(":checked")&&0===t.html().length&&t.html('<i class="forminator-icon-loader forminator-loading"></i>')});var c=!!d.$el.find(".forminator-pagination");p.ajax({type:"POST",url:b.ForminatorFront.ajaxUrl,data:e,beforeSend:function(){c||d.$el.find("button").attr("disabled","disabled"),r.trigger("before:forminator:quiz:submit",[e,n])},success:function(u){var t;u.success?(t="",a.removeClass("forminator-hidden"),b.history.pushState("forminator","Forminator",u.data.result_url),"nowrong"===u.data.type?(t=u.data.result,a.html(t),c||d.$el.find(".forminator-answer input").attr("disabled","disabled")):"knowledge"===u.data.type&&(t=u.data.finalText,0<a.length&&a.html(t),Object.keys(u.data.result).forEach(function(t){var e,r=d.$el.find("#"+t),n=r.find(".forminator-question--result"),o=r.find(".forminator-submit-rightaway"),i=r.find(".forminator-answer input"),a=u.data.result[t].isCorrect?(e="forminator-is_correct",'<i class="forminator-icon-check"></i>'):(e="forminator-is_incorrect",'<i class="forminator-icon-cancel"></i>');if(n.text(u.data.result[t].message),n.addClass("forminator-show"),o.attr("disabled",!0),o.attr("aria-disabled",!0),i.attr("disabled",!0),i.attr("aria-disabled",!0),y===u.data.result[t].answer)for(var s,l=u.data.result[t].answers,f=0;f<l.length;f++)(s=r.find('[id|="'+l[f].id+'"]').closest(".forminator-answer")).addClass(e),(0===s.find(".forminator-answer--status").html().length||0!==s.find(".forminator-answer--status .forminator-icon-loader").length)&&s.find(".forminator-answer--status").html(a);else(s=r.find('[id|="'+u.data.result[t].answer+'"]').closest(".forminator-answer")).addClass(e),0!==s.find(".forminator-answer--status").html().length&&0===s.find(".forminator-answer--status .forminator-icon-loader").length||s.find(".forminator-answer--status").html(a)})),r.trigger("forminator:quiz:submit:success",[e,n,t]),0===a.find(".forminator-quiz--summary").length||a.parent().hasClass("forminator-pagination--content")||d.focus_to_element(a.find(".forminator-quiz--summary"))):(d.$el.find("button").removeAttr("disabled"),r.trigger("forminator:quiz:submit:failed",[e,n]))}}).always(function(){r.trigger("after:forminator:quiz:submit",[e,n]),r.nextAll(".leads-quiz-loader").remove()})}return!1}),p("body").on("click","#forminator-quiz-leads-"+h+" .forminator-lead-form-skip",function(t){d.showQuiz(p("#forminator-module-"+m)),void 0!==d.settings.form_placement&&"end"===d.settings.form_placement&&(d.settings.form_placement="skip",d.$el.submit())}),p("body").on("click",".forminator-result--retake",function(t){var e={action:"forminator_reload_quiz",pageId:d.$el.find('input[name="page_id"]').val(),nonce:d.$el.find('input[name="forminator_nonce"]').val()};t.preventDefault(),p.post(b.ForminatorFront.ajaxUrl,e,function(t){1==t.success&&t.html&&b.location.replace(t.html)})})},handle_submit_poll:function(){var u=this,c=u.$el.html();u.$el.find(".forminator-response-message").not(":hidden").length&&u.focus_to_element(u.$el.find(".forminator-response-message"),!0),p("body").on("submit.frontSubmit",this.settings.forminator_selector,function(t){var r,n,o,i,a,s;return 0===u.$el.find('input[type="hidden"][value="forminator_submit_preview_form_poll"]').length&&(r=p(this),n=new FormData(this),o=r.serialize(),i=u.$el.find(".forminator-response-message"),a=u.$el.find("fieldset"),s=u.$el.find(".forminator-button"),!u.$el.hasClass("forminator_ajax")||(l(),p.ajax({type:"POST",url:b.ForminatorFront.ajaxUrl,data:o,beforeSend:function(){s.addClass("forminator-onload"),r.trigger("before:forminator:poll:submit",[o,n])},success:function(t){var e=t.success?"success":"error";s.removeClass("forminator-onload"),!1===t.success?(f(t.data.message,e),r.trigger("forminator:poll:submit:failed",[o,n])):void 0!==t.data&&(e=t.data.success?"success":"error",f(t.data.message,e),setTimeout(function(){l()},2500)),!0===t.success&&(void 0!==t.data.url?b.location.href=t.data.url:void 0!==t.data.chart_data&&1<t.data.chart_data.length&&("link_on"===t.data.results_behav&&r.find(".forminator-note").length&&(r.find(".forminator-note").remove(),r.find(".forminator-poll-footer").append(t.data.results_link)),"show_after"===t.data.results_behav)&&u.render_poll_chart(t.data.chart_data,t.data.back_button,u,c,[t.data.votes_text,t.data.votes_count,[t.data.grids_color,t.data.labels_color,t.data.onchart_label],[t.data.tooltips_bg,t.data.tooltips_color]]),r.trigger("forminator:poll:submit:success",[o,n]))},error:function(){l(),s.removeClass(".forminator-onload"),r.trigger("forminator:poll:submit:failed",[o,n])}}).always(function(){r.trigger("after:forminator:poll:submit",[o,n])}),!1));function l(){i.html(""),i.removeClass("forminator-show"),i.removeClass("forminator-error"),i.removeClass("forminator-success"),i.removeAttr("tabindex"),i.attr("aria-hidden",!0),a.removeClass("forminator-has_error")}function f(t,e){i.html("<p>"+t+"</p>"),i.addClass("forminator-"+e),i.addClass("forminator-show"),i.removeAttr("aria-hidden"),i.attr("tabindex","-1"),i.focus(),"error"!==e||a.find('input[type="radio"]').is(":checked")||a.addClass("forminator-has_error")}})},render_poll_chart:function(t,e,r,n,o){var i,a,s="forminator-chart-poll-"+(r.$el.attr("id")+"-"+r.$el.data("forminatorRender")),l=r.$el.find(".forminator-poll-body"),f=r.$el.find(".forminator-poll-footer");a=r.$el.find(".forminator-chart-wrapper"),i=r.$el.find(".forminator-chart"),a.remove(),i.remove(),a=p('<canvas id="'+s+'" class="forminator-chart" role="img" aria-hidden="true"></canvas>'),l.append(a),FUI.pollChart("#"+s,t,r.settings.chart_design,o),(i=l.find(".forminator-field")).hide(),i.attr("aria-hidden","true"),a=r.$el.find(".forminator-chart"),((s=r.$el.find(".forminator-chart-wrapper")).length?(a.addClass("forminator-show"),s.addClass("forminator-show"),s.removeAttr("aria-hidden"),s.attr("tabindex","-1"),s):(a.html("<p>Fallback text...</p>"),a.addClass("forminator-show"),a.removeAttr("aria-hidden"),a.attr("tabindex","-1"),a)).focus(),t=p(e),f.empty(),f.append(t),r.$el.find(".forminator-button").click(function(t){r.$el.hasClass("forminator_ajax")?r.$el.html(n):location.reload(),t.preventDefault()})},focus_to_element:function(t,e,r,n){r=r||!1,n=n||0,e=e||!1;var o="html,body";function i(t){t.attr("tabindex")||t.attr("tabindex",-1),t.hasClass("forminator-select2")||t.focus(),r&&t.show().delay(n).fadeOut("slow")}0<t.closest(".sui-dialog").length&&(o=".sui-dialog"),0<t.closest(".wph-modal").length&&(o=".wph-modal"),t.hasClass("forminator-textarea")||t.parent(".wp-editor-container").length?t.hasClass("forminator-textarea")&&t.parent(".wp-editor-container").length&&(t=t.parent(".wp-editor-container")):t.show(),e?i(t):p(o).animate({scrollTop:t.offset().top-(p(b).height()-t.outerHeight(!0))/2},500,function(){i(t)})},show_messages:function(t){var d,m=this,h=m.$el.data("forminatorFrontCondition");return void 0!==h&&(this.$el.find(".forminator-error-message").remove(),d=0,t.forEach(function(t){var e=Object.keys(t),e=h.get_form_field(e),r=p(e),n=r.closest(".forminator-field"),o=r.closest(".forminator-date-input"),i=r.closest(".forminator-timepicker"),a=!1,s=!1,l=!1,f=r.attr("id")+"-error",u=r.attr("aria-describedby"),t=Object.values(t),c='<span class="forminator-error-message" id="'+f+'"></span>';e.length&&(0===d&&(m.$el.trigger("forminator.front.pagination.focus.input",[e]),m.focus_to_element(e)),(0<o.length?(s=(a=o.parent()).find('.forminator-error-message[data-error-field="'+r.data("field")+'"]'),l=a.find(".forminator-description"),c='<span class="forminator-error-message" data-error-field="'+r.data("field")+'" id="'+f+'"></span>',0===s.length&&("day"===r.data("field")&&(a.find('.forminator-error-message[data-error-field="year"]').length?p(c).insertBefore(a.find('.forminator-error-message[data-error-field="year"]')):0===l.length?a.append(c):p(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),"month"===r.data("field")&&(a.find('.forminator-error-message[data-error-field="day"]').length?p(c).insertBefore(a.find('.forminator-error-message[data-error-field="day"]')):0===l.length?a.append(c):p(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),"year"===r.data("field"))&&(0===l.length?a.append(c):p(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),a.find('.forminator-error-message[data-error-field="'+r.data("field")+'"]').html(t),n.find(".forminator-error-message")):0<i.length&&0<t[0].length?(s=(a=i.parent()).find('.forminator-error-message[data-error-field="'+r.data("field")+'"]'),l=a.find(".forminator-description"),c='<span class="forminator-error-message" data-error-field="'+r.data("field")+'" id="'+f+'"></span>',0===s.length&&("hours"===r.data("field")&&(a.find('.forminator-error-message[data-error-field="minutes"]').length?p(c).insertBefore(a.find('.forminator-error-message[data-error-field="minutes"]')):0===l.length?a.append(c):p(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),"minutes"===r.data("field"))&&(0===l.length?a.append(c):p(c).insertBefore(l),0===n.find(".forminator-error-message").length)&&n.append('<span class="forminator-error-message" id="'+f+'"></span>'),a.find('.forminator-error-message[data-error-field="'+r.data("field")+'"]').html(t),n.find(".forminator-error-message")):(s=n.find(".forminator-error-message"),l=n.find(".forminator-description"),0===s.length&&(0===l.length?n.append(c):p(c).insertBefore(l)),n.find(".forminator-error-message"))).html(t),u?((e=u.split(" ")).includes(f)||e.push(f),o=e.join(" "),r.attr("aria-describedby",o)):r.attr("aria-describedby",f),r.attr("aria-invalid","true"),n.addClass("forminator-has_error"),d++)})),this},multi_upload_disable:function(t,e){t.find(".forminator-multi-upload input").each(function(){"ajax"===p(this).data("method")&&p(this).attr("disabled",e)})},disable_form_submit:function(t,e){t.$el.find(".forminator-button-submit").prop("disabled",e)},showLeadsLoader:function(t){t.settings.hasLeads&&"end"===t.settings.form_placement&&p("#forminator-quiz-leads-"+t.settings.quiz_id).append('<div class="leads-quiz-loader forminator-response-message"><i class="forminator-icon-loader forminator-loading" aria-hidden="true"></i><style>.leads-quiz-loader{padding:20px;text-align:center;}.leads-quiz-loader .forminator-loading:before{display:block;}</style></div>')}}),p.fn[r]=function(t){return this.each(function(){p.data(this,r)||p.data(this,r,new e(this,t))})}}(jQuery,window,void document),function(p,b,o){"use strict";var r="forminatorFrontMultiFile",n={};function e(t,e){this.element=t,this.$el=p(this.element),this.form=p.extend({},n,e),this._defaults=n,this._name=r,this.form_id=0,this.uploader=this.$el,this.element=this.uploader.data("element"),this.init()}p.extend(e.prototype,{init:function(){var i=this,a=[],s=[];0<this.form.find("input[name=form_id]").length&&(this.form_id=this.form.find("input[name=form_id]").val()),this.uploader.on("drag dragstart dragend dragover dragenter dragleave drop",function(t){t.preventDefault(),t.stopPropagation()}),this.uploader.on("dragover dragenter",function(t){p(this).addClass("forminator-dragover")}),this.uploader.on("dragleave dragend drop",function(t){p(this).removeClass("forminator-dragover")}),this.uploader.find(".forminator-upload-file--forminator-field-"+this.element).on("click",function(t){i.form.find(".forminator-field-"+i.element+"-"+i.form_id).click()}),this.uploader.on("drop",function(t){o.querySelector(".forminator-field-"+i.element+"-"+i.form_id).files=t.originalEvent.dataTransfer.files,i.form.find(".forminator-field-"+i.element+"-"+i.form_id).change()}),this.uploader.on("click",function(t){t.target===t.currentTarget&&i.form.find(".forminator-field-"+i.element+"-"+i.form_id).click()}),this.uploader.find(".forminator-multi-upload-message, .forminator-multi-upload-message p, .forminator-multi-upload-message .forminator-icon-upload").on("click",function(t){t.target===t.currentTarget&&i.form.find(".forminator-field-"+i.element+"-"+i.form_id).click()}),this.form.on("forminator:form:submit:success",function(t){a=[]}),this.form.find(".forminator-field-"+i.element+"-"+i.form_id).on("change",function(t){var r,n,o;i.uploadingFile||(i.uploadingFile=1,r=p(this),n=this.files,o=[],p.when().then(function(){r.closest(".forminator-field").removeClass("forminator-has_error");for(var t=0;t<n.length;t++)o.push(n[t]),a.push(n[t]);s=i.handleChangeCallback(o,r,s);var e=Array.prototype.slice.call(a);0<e.length&&(n=i.FileObjectItem(e),"submission"===r.data("method"))&&r.prop("files",n)}).done(function(){i.uploadingFile=null}))}),this.delete_files(a,s)},handleChangeCallback:function(s,l,f){var u=this,c=0,d=new FormData,t=this.form.find('input[name="forminator_nonce"]').val(),m=l.data("method"),h=(h=u.element).split("_")[0];return d.append("action","forminator_multiple_file_upload"),d.append("form_id",this.form_id),d.append("element_id",h),d.append("nonce",t),p.each(s,function(t,n){var e,o=u.progress_bar(n,m),r=u.form.find(".upload-container-"+u.element+" li").length,i=void 0!==l.data("filetype")?l.data("filetype"):"",i=new RegExp("(.*?).("+i+")$"),a=n.name.toLowerCase();void 0!==l.data("size")&&l.data("size")<=n.size?(e=l.data("size-message"),u.upload_fail_response(o,e)):i.test(a)?"ajax"===m?(d.delete(u.element),d.delete("totalFiles"),d.append("totalFiles",r),d.append(h,n),f.push(p.ajax({xhr:function(){var t=new b.XMLHttpRequest;return t.upload.addEventListener("progress",function(t){t.lengthComputable&&(t=t.loaded/t.total*100)<90&&u.form.find("#"+o+" .progress-percentage").html(Math.round(t)+"% of ")},!1),t},type:"POST",url:b.ForminatorFront.ajaxUrl,data:d,cache:!1,contentType:!1,processData:!1,beforeSend:function(){u.form.find(".forminator-button-submit").attr("disabled",!0),u.$el.trigger("before:forminator:multiple:upload",d)},success:function(t){var e=u.element,r={success:t.success,message:"undefined"!==t.data.message?t.data.message:"",file_id:o,file_name:void 0!==t.data.file_url?t.data.file_url.replace(/^.*[\\\/]/,""):n.name,mime_type:n.type};u.add_upload_file(e,r),!0===t.success&&!0===t.data.success&&void 0!==t.data?(u.upload_success_response(o),u.$el.trigger("success:forminator:multiple:upload",d)):(u.upload_fail_response(o,t.data.message),void 0!==t.data.error_type&&"limit"===t.data.error_type&&u.form.find("#"+o).addClass("forminator-upload-limit_error"),u.$el.trigger("fail:forminator:multiple:upload",d))},complete:function(t,e){c++,s.length===c&&u.form.find(".forminator-button-submit").attr("disabled",!1),u.$el.trigger("complete:forminator:multiple:upload",d)},error:function(t){u.upload_fail_response(o,b.ForminatorFront.cform.process_error)}}))):(i=!0,e=b.ForminatorFront.cform.process_error,void 0!==l.data("limit")&&l.data("limit")<r&&(i=!1,u.form.find("#"+o).addClass("forminator-upload-limit_error"),e=l.data("limit-message")),i?u.upload_success_response(o):u.upload_fail_response(o,e)):(e="."+a.split(".").pop()+" "+l.data("filetype-message"),u.upload_fail_response(o,e))}),f},upload_fail_response:function(t,e){this.form.trigger("validation:error"),this.form.find("#"+t).addClass("forminator-has_error"),this.form.find("#"+t).find('.forminator-uploaded-file--size [class*="forminator-icon-"]').addClass("forminator-icon-warning").removeClass("forminator-icon-loader").removeClass("forminator-loading"),this.form.find("#"+t+" .progress-percentage").html("0% of "),this.form.find("#"+t+" .forminator-uploaded-file--content").after('<div class="forminator-error-message">'+e+"</div>")},upload_success_response:function(t){this.form.find("#"+t+" .progress-percentage").html("100% of "),this.form.find("#"+t+' .forminator-uploaded-file--size [class*="forminator-icon-"]').remove(),this.form.find("#"+t+" .progress-percentage").remove()},progress_bar:function(t,e){var r="upload-process-"+Math.random().toString(36).substr(2,7),n=t.name,o=this.bytes_to_size(t.size,2),i=this.uploader.closest(".forminator-field").find(".forminator-uploaded-files"),a="";this.progress_image_preview(t,r);var t='<div class="forminator-uploaded-file--preview" aria-hidden="true"><span class="forminator-icon-file" aria-hidden="true"></span></div>',s='<p class="forminator-uploaded-file--title">'+n+"</p>",a=(a=(a=(a=(a=a+('<li id="'+r+'" class="forminator-uploaded-file">')+'<div class="forminator-uploaded-file--content">')+(t=!function(t){switch((t=(t=t).split("."))[t.length-1].toLowerCase()){case"jpg":case"jpe":case"jpeg":case"png":case"gif":case"ico":return 1}}(n)?t:'<div class="forminator-uploaded-file--image" aria-hidden="true"><div class="forminator-img-preview" role="image"></div></div>')+'<div class="forminator-uploaded-file--text">')+s+('<p class="forminator-uploaded-file--size"><span class="forminator-icon-loader forminator-loading" aria-hidden="true"></span><span class="progress-percentage">29% of </span>'+o+"</p>"))+"</div>"+('<button type="button" class="forminator-uploaded-file--delete forminator-button-delete" data-method="'+e+'" data-element="'+this.element+'" data-value="'+r+'"><span class="forminator-icon-close" aria-hidden="true"></span><span class="forminator-screen-reader-only">Delete uploaded file</span></button>'))+"</div>"+"</li>";return i.hasClass(".forminator-has-files")||i.addClass("forminator-has-files"),i.append(a),r},bytes_to_size:function(t,e){var r;return 0===t?"0 Bytes":(e=e<0?0:e,r=Math.floor(Math.log(t)/Math.log(1024)),parseFloat((t/Math.pow(1024,r)).toFixed(e))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r])},progress_image_preview:function(t,e){var r;t&&((r=new FileReader).onload=function(t){p("#"+e+" .forminator-img-preview").css("background-image","url("+t.target.result+")")},r.readAsDataURL(t))},get_uplaoded_files:function(){var t=this.form.find(".forminator-multifile-hidden").val();return void 0===t||""===t?{}:p.parseJSON(t)},get_uplaoded_file:function(t){var e=this.get_uplaoded_files();return void 0===e[t]&&(e[t]=[]),e[t]},add_upload_file:function(t,e){var r=this.get_uplaoded_file(t);r.unshift(e),this.set_upload_file(t,r)},set_upload_file:function(t,e){var r=this.get_uplaoded_files(),n=this.form.find(".forminator-multifile-hidden");r[t]=e,n.val(JSON.stringify(r))},get_uploaded_file_id:function(t,r){var n=null,t=this.get_uplaoded_file(t);return p.each(t,function(t,e){r===e.file_id&&(n=t)}),n},delete_files:function(l,f){var u=this;p(o).on("click",".forminator-uploaded-file--delete",function(t){t.preventDefault();var e,r,n,t=p(this),o=t.data("value"),i=t.data("method"),a=t.data("element"),s=(void 0!==o&&void 0!==a&&void 0!==i&&(e=u.form.find("#"+o).index(),t=p(t).closest("li#"+o),r=u.get_uplaoded_files(),n=u.form.find(".forminator-multifile-hidden"),r&&"ajax"===i&&(void 0!==f[e]&&(f[e].abort(),f.splice(e,1)),void 0!==n)&&(""!==(o=u.get_uploaded_file_id(a,o))&&null!==o&&r[a].splice(o,1),n.val(JSON.stringify(r))),void 0!==i&&"submission"===i&&u.remove_object(e,l,a),p(t).remove()),u.form.find(".forminator-field-"+a+"-"+u.form_id)),o=u.form.find(".upload-container-"+a+" li");void 0!==s.data("limit")&&(p.each(o,function(t){s.data("limit")>t&&p(this).hasClass("forminator-upload-limit_error")&&(t=p(this).attr("id"),t=u.get_uploaded_file_id(a,t),p(this).removeClass("forminator-has_error"),p(this).find(".forminator-error-message, .forminator-icon-warning, .progress-percentage").remove(),""!==t)&&null!==t&&void 0!==r[a][t]&&(r[a][t].success=!0)}),n.val(JSON.stringify(r))),0===o.length&&s.val(""),0===u.form.find(".forminator-uploaded-file.forminator-has_error").length&&(u.form.trigger("forminator:uploads:valid"),u.form.find(".forminator-button-submit").attr("disabled",!1))})},remove_object:function(t,e,r){var n,r=o.querySelector(".forminator-field-"+r+"-"+this.form_id);void 0!==r&&0<(n=r.files).length&&(n=Array.prototype.slice.call(n),e.splice(t,1),n.splice(t,1),r.files=this.FileObjectItem(n))},FileObjectItem:function(t){for(var e,r=e=(t=(t=[].slice.call(Array.isArray(t)?t:arguments)).reverse()).length,n=!0;r--&&n;)n=t[r]instanceof File;if(!n)throw new TypeError("expected argument to FileList is File or array of File objects");for(r=new ClipboardEvent("").clipboardData||new DataTransfer;e--;)r.items.add(t[e]);return r.files}}),p.fn[r]=function(t){return this.each(function(){p.data(this,r)||p.data(this,r,new e(this,t))})}}(jQuery,window,document);
     1(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
     2"use strict";
     3
     4Object.defineProperty(exports, "__esModule", {
     5  value: true
     6});
     7exports.default = void 0;
     8var _frontCalculatorParser = _interopRequireDefault(require("./parser/front.calculator.parser.tokenizer"));
     9var _frontCalculatorSymbol = _interopRequireDefault(require("./symbol/front.calculator.symbol.loader"));
     10var _frontCalculator = _interopRequireDefault(require("./parser/front.calculator.parser"));
     11var _frontCalculatorSymbol2 = _interopRequireDefault(require("./symbol/front.calculator.symbol.number"));
     12var _frontCalculatorSymbolConstant = _interopRequireDefault(require("./symbol/abstract/front.calculator.symbol.constant.abstract"));
     13var _frontCalculatorParserNode = _interopRequireDefault(require("./parser/node/front.calculator.parser.node.symbol"));
     14var _frontCalculatorSymbolOperator = _interopRequireDefault(require("./symbol/abstract/front.calculator.symbol.operator.abstract"));
     15var _frontCalculatorSymbol3 = _interopRequireDefault(require("./symbol/front.calculator.symbol.separator"));
     16var _frontCalculatorParserNode2 = _interopRequireDefault(require("./parser/node/front.calculator.parser.node.function"));
     17var _frontCalculatorParserNode3 = _interopRequireDefault(require("./parser/node/front.calculator.parser.node.container"));
     18function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     19function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     20function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     21function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     22function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     23function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     24function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**********
     25                                                                                                                                                                                                                                                                                                                                                                                               * Attempt to rewrite Forminator_Calculator backend
     26                                                                                                                                                                                                                                                                                                                                                                                               *
     27                                                                                                                                                                                                                                                                                                                                                                                               * @see Forminator_Calculator
     28                                                                                                                                                                                                                                                                                                                                                                                               *
     29                                                                                                                                                                                                                                                                                                                                                                                               ***********/
     30var FrontCalculator = exports.default = /*#__PURE__*/function () {
     31  /**
     32   *
     33   * @param {string} term
     34   */
     35  function FrontCalculator(term) {
     36    _classCallCheck(this, FrontCalculator);
     37    /**
     38     *
     39     * @type {string}
     40     */
     41    this.term = term;
     42
     43    /**
     44     *
     45     * @type {FrontCalculatorParserTokenizer}
     46     */
     47    this.tokenizer = new _frontCalculatorParser.default(this.term);
     48
     49    /**
     50     *
     51     * @type {FrontCalculatorSymbolLoader}
     52     */
     53    this.symbolLoader = new _frontCalculatorSymbol.default();
     54
     55    /**
     56     *
     57     * @type {FrontCalculatorParser}
     58     */
     59    this.parser = new _frontCalculator.default(this.symbolLoader);
     60  }
     61
     62  /**
     63   *
     64   * @returns {FrontCalculatorParserNodeContainer}
     65   */
     66  _createClass(FrontCalculator, [{
     67    key: "parse",
     68    value: function parse() {
     69      // reset
     70      this.tokenizer.input = this.term;
     71      this.tokenizer.reset();
     72      var tokens = this.tokenizer.tokenize();
     73      if (tokens.length === 0) {
     74        throw 'Error: Empty token of calculator term.';
     75      }
     76      var rootNode = this.parser.parse(tokens);
     77      if (rootNode.isEmpty()) {
     78        throw 'Error: Empty nodes of calculator tokens.';
     79      }
     80      return rootNode;
     81    }
     82
     83    /**
     84     *
     85     * @returns {number}
     86     */
     87  }, {
     88    key: "calculate",
     89    value: function calculate() {
     90      var result = 0;
     91      var rootNode = this.parse();
     92      if (false === rootNode) {
     93        return result;
     94      }
     95      return this.calculateNode(rootNode);
     96    }
     97
     98    /**
     99     *Calculates the numeric value / result of a node of
     100     * any known and calculable type. (For example symbol
     101     * nodes with a symbol of type separator are not
     102     * calculable.)
     103     *
     104     * @param {FrontCalculatorParserNodeAbstract} node
     105     *
     106     * @returns {number}
     107     */
     108  }, {
     109    key: "calculateNode",
     110    value: function calculateNode(node) {
     111      if (node instanceof _frontCalculatorParserNode.default) {
     112        return this.calculateSymbolNode(node);
     113      } else if (node instanceof _frontCalculatorParserNode2.default) {
     114        return this.calculateFunctionNode(node);
     115      } else if (node instanceof _frontCalculatorParserNode3.default) {
     116        return this.calculateContainerNode(node);
     117      } else {
     118        throw 'Error: Cannot calculate node of unknown type "' + node.constructor.name + '"';
     119      }
     120    }
     121
     122    /**
     123     * This method actually calculates the results of every sub-terms
     124     * in the syntax tree (which consists of nodes).
     125     * It can call itself recursively.
     126     * Attention: $node must not be of type FunctionNode!
     127     *
     128     * @param {FrontCalculatorParserNodeContainer} containerNode
     129     *
     130     * @returns {number}
     131     */
     132  }, {
     133    key: "calculateContainerNode",
     134    value: function calculateContainerNode(containerNode) {
     135      if (containerNode instanceof _frontCalculatorParserNode2.default) {
     136        throw 'Error: Expected container node but got a function node';
     137      }
     138      var result = 0;
     139      var nodes = containerNode.childNodes;
     140      var orderedOperatorNodes = this.detectCalculationOrder(nodes);
     141
     142      // Actually calculate the term. Iterates over the ordered operators and
     143      // calculates them, then replaces the parts of the operation by the result.
     144      for (var i = 0; i < orderedOperatorNodes.length; i++) {
     145        var operatorNode = orderedOperatorNodes[i].node;
     146        var index = orderedOperatorNodes[i].index;
     147        var leftOperand = null;
     148        var leftOperandIndex = null;
     149        var nodeIndex = 0;
     150        while (nodeIndex !== index) {
     151          if (nodes[nodeIndex] === undefined) {
     152            nodeIndex++;
     153            continue;
     154          }
     155          leftOperand = nodes[nodeIndex];
     156          leftOperandIndex = nodeIndex;
     157          nodeIndex++;
     158        }
     159        nodeIndex++;
     160        while (nodes[nodeIndex] === undefined) {
     161          nodeIndex++;
     162        }
     163        var rightOperand = nodes[nodeIndex];
     164        var rightOperandIndex = nodeIndex;
     165        var rightNumber = !isNaN(rightOperand) ? rightOperand : this.calculateNode(rightOperand);
     166
     167        /**
     168         * @type {FrontCalculatorSymbolOperatorAbstract}
     169         */
     170        var symbol = operatorNode.symbol;
     171        if (operatorNode.isUnaryOperator) {
     172          result = symbol.operate(null, rightNumber);
     173
     174          // Replace the participating symbols of the operation by the result
     175          delete nodes[rightOperandIndex]; // `delete` operation only set the value to empty, not `actually` remove it
     176          nodes[index] = result;
     177        } else {
     178          if (leftOperandIndex !== null && leftOperand !== null) {
     179            var leftNumber = !isNaN(leftOperand) ? leftOperand : this.calculateNode(leftOperand);
     180            result = symbol.operate(leftNumber, rightNumber);
     181
     182            // Replace the participating symbols of the operation by the result
     183            delete nodes[leftOperandIndex];
     184            delete nodes[rightOperandIndex];
     185            nodes[index] = result;
     186          }
     187        }
     188      }
     189
     190      //cleanup empty nodes
     191      nodes = nodes.filter(function (node) {
     192        return node !== undefined;
     193      });
     194      if (nodes.length === 0) {
     195        throw 'Error: Missing calculable subterm. Are there empty brackets?';
     196      }
     197      if (nodes.length > 1) {
     198        throw 'Error: Missing operators between parts of the term.';
     199      }
     200
     201      // The only remaining element of the $nodes array contains the overall result
     202      result = nodes.pop();
     203
     204      // If the $nodes array did not contain any operator (but only one node) than
     205      // the result of this node has to be calculated now
     206      if (isNaN(result)) {
     207        return this.calculateNode(result);
     208      }
     209      return result;
     210    }
     211
     212    /**
     213     * Returns the numeric value of a function node.
     214     * @param {FrontCalculatorParserNodeFunction} functionNode
     215     *
     216     * @returns {number}
     217     */
     218  }, {
     219    key: "calculateFunctionNode",
     220    value: function calculateFunctionNode(functionNode) {
     221      var nodes = functionNode.childNodes;
     222      var functionArguments = []; // ex : func(1+2,3,4) : 1+2 need to be calculated first
     223      var argumentChildNodes = [];
     224      var containerNode = null;
     225      for (var i = 0; i < nodes.length; i++) {
     226        var node = nodes[i];
     227        if (node instanceof _frontCalculatorParserNode.default) {
     228          if (node.symbol instanceof _frontCalculatorSymbol3.default) {
     229            containerNode = new _frontCalculatorParserNode3.default(argumentChildNodes);
     230            functionArguments.push(this.calculateNode(containerNode));
     231            argumentChildNodes = [];
     232          } else {
     233            argumentChildNodes.push(node);
     234          }
     235        } else {
     236          argumentChildNodes.push(node);
     237        }
     238      }
     239      if (argumentChildNodes.length > 0) {
     240        containerNode = new _frontCalculatorParserNode3.default(argumentChildNodes);
     241        functionArguments.push(this.calculateNode(containerNode));
     242      }
     243
     244      /**
     245       *
     246       * @type {FrontCalculatorSymbolFunctionAbstract}
     247       */
     248      var symbol = functionNode.symbolNode.symbol;
     249      return symbol.execute(functionArguments);
     250    }
     251
     252    /**
     253     * Returns the numeric value of a symbol node.
     254     * Attention: node.symbol must not be of type AbstractOperator!
     255     *
     256     * @param {FrontCalculatorParserNodeSymbol} symbolNode
     257     *
     258     * @returns {Number}
     259     */
     260  }, {
     261    key: "calculateSymbolNode",
     262    value: function calculateSymbolNode(symbolNode) {
     263      var symbol = symbolNode.symbol;
     264      var number = 0;
     265      if (symbol instanceof _frontCalculatorSymbol2.default) {
     266        number = symbolNode.token.value;
     267
     268        // Convert string to int or float (depending on the type of the number)
     269        // If the number has a longer fractional part, it will be cut.
     270        number = Number(number);
     271      } else if (symbol instanceof _frontCalculatorSymbolConstant.default) {
     272        number = symbol.value;
     273      } else {
     274        throw 'Error: Found symbol of unexpected type "' + symbol.constructor.name + '", expected number or constant';
     275      }
     276      return number;
     277    }
     278
     279    /**
     280     * Detect the calculation order of a given array of nodes.
     281     * Does only care for the precedence of operators.
     282     * Does not care for child nodes of container nodes.
     283     * Returns a new array with ordered symbol nodes
     284     *
     285     * @param {FrontCalculatorParserNodeAbstract[]} nodes
     286     *
     287     * @return {Array}
     288     */
     289  }, {
     290    key: "detectCalculationOrder",
     291    value: function detectCalculationOrder(nodes) {
     292      var operatorNodes = [];
     293
     294      // Store all symbol nodes that have a symbol of type abstract operator in an array
     295      for (var i = 0; i < nodes.length; i++) {
     296        var node = nodes[i];
     297        if (node instanceof _frontCalculatorParserNode.default) {
     298          if (node.symbol instanceof _frontCalculatorSymbolOperator.default) {
     299            var operatorNode = {
     300              index: i,
     301              node: node
     302            };
     303            operatorNodes.push(operatorNode);
     304          }
     305        }
     306      }
     307      operatorNodes.sort(
     308      /**
     309       * Returning 1 means $nodeTwo before $nodeOne, returning -1 means $nodeOne before $nodeTwo.
     310       * @param {Object} operatorNodeOne
     311       * @param {Object} operatorNodeTwo
     312       */
     313      function (operatorNodeOne, operatorNodeTwo) {
     314        var nodeOne = operatorNodeOne.node;
     315        var nodeTwo = operatorNodeTwo.node;
     316
     317        // First-level precedence of node one
     318        /**
     319         *
     320         * @type {FrontCalculatorSymbolOperatorAbstract}
     321         */
     322        var symbolOne = nodeOne.symbol;
     323        var precedenceOne = 2;
     324        if (nodeOne.isUnaryOperator) {
     325          precedenceOne = 3;
     326        }
     327
     328        // First-level precedence of node two
     329        /**
     330         *
     331         * @type {FrontCalculatorSymbolOperatorAbstract}
     332         */
     333        var symbolTwo = nodeTwo.symbol;
     334        var precedenceTwo = 2;
     335        if (nodeTwo.isUnaryOperator) {
     336          precedenceTwo = 3;
     337        }
     338
     339        // If the first-level precedence is the same, compare the second-level precedence
     340        if (precedenceOne === precedenceTwo) {
     341          precedenceOne = symbolOne.precedence;
     342          precedenceTwo = symbolTwo.precedence;
     343        }
     344
     345        // If the second-level precedence is the same, we have to ensure that the sorting algorithm does
     346        // insert the node / token that is left in the term before the node / token that is right.
     347        // Therefore we cannot return 0 but compare the positions and return 1 / -1.
     348        if (precedenceOne === precedenceTwo) {
     349          return nodeOne.token.position < nodeTwo.token.position ? -1 : 1;
     350        }
     351        return precedenceOne < precedenceTwo ? 1 : -1;
     352      });
     353      return operatorNodes;
     354    }
     355  }]);
     356  return FrontCalculator;
     357}();
     358if (window['forminatorCalculator'] === undefined) {
     359  window.forminatorCalculator = function (term) {
     360    return new FrontCalculator(term);
     361  };
     362}
     363
     364},{"./parser/front.calculator.parser":2,"./parser/front.calculator.parser.tokenizer":4,"./parser/node/front.calculator.parser.node.container":6,"./parser/node/front.calculator.parser.node.function":7,"./parser/node/front.calculator.parser.node.symbol":8,"./symbol/abstract/front.calculator.symbol.constant.abstract":10,"./symbol/abstract/front.calculator.symbol.operator.abstract":12,"./symbol/front.calculator.symbol.loader":16,"./symbol/front.calculator.symbol.number":17,"./symbol/front.calculator.symbol.separator":18}],2:[function(require,module,exports){
     365"use strict";
     366
     367Object.defineProperty(exports, "__esModule", {
     368  value: true
     369});
     370exports.default = void 0;
     371var _frontCalculatorParser = _interopRequireDefault(require("./front.calculator.parser.token"));
     372var _frontCalculatorSymbol = _interopRequireDefault(require("../symbol/front.calculator.symbol.number"));
     373var _frontCalculatorSymbolOpening = _interopRequireDefault(require("../symbol/brackets/front.calculator.symbol.opening.bracket"));
     374var _frontCalculatorSymbolClosing = _interopRequireDefault(require("../symbol/brackets/front.calculator.symbol.closing.bracket"));
     375var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../symbol/abstract/front.calculator.symbol.function.abstract"));
     376var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../symbol/abstract/front.calculator.symbol.operator.abstract"));
     377var _frontCalculatorSymbol2 = _interopRequireDefault(require("../symbol/front.calculator.symbol.separator"));
     378var _frontCalculatorParserNode = _interopRequireDefault(require("./node/front.calculator.parser.node.symbol"));
     379var _frontCalculatorParserNode2 = _interopRequireDefault(require("./node/front.calculator.parser.node.container"));
     380var _frontCalculatorParserNode3 = _interopRequireDefault(require("./node/front.calculator.parser.node.function"));
     381function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     382function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     383function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     384function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     385function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     386function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     387function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     388/**
     389 * The parsers has one important method: parse()
     390 * It takes an array of tokens as input and
     391 * returns an array of nodes as output.
     392 * These nodes are the syntax tree of the term.
     393 *
     394 */
     395var FrontCalculatorParser = exports.default = /*#__PURE__*/function () {
     396  /**
     397   *
     398   * @param {FrontCalculatorSymbolLoader} symbolLoader
     399   */
     400  function FrontCalculatorParser(symbolLoader) {
     401    _classCallCheck(this, FrontCalculatorParser);
     402    /**
     403     *
     404     * @type {FrontCalculatorSymbolLoader}
     405     */
     406    this.symbolLoader = symbolLoader;
     407  }
     408
     409  /**
     410   * Parses an array with tokens. Returns an array of nodes.
     411   * These nodes define a syntax tree.
     412   *
     413   * @param {FrontCalculatorParserToken[]} tokens
     414   *
     415   * @returns FrontCalculatorParserNodeContainer
     416   */
     417  _createClass(FrontCalculatorParser, [{
     418    key: "parse",
     419    value: function parse(tokens) {
     420      var symbolNodes = this.detectSymbols(tokens);
     421      var nodes = this.createTreeByBrackets(symbolNodes);
     422      nodes = this.transformTreeByFunctions(nodes);
     423      this.checkGrammar(nodes);
     424
     425      // Wrap the nodes in an array node.
     426      return new _frontCalculatorParserNode2.default(nodes);
     427    }
     428
     429    /**
     430     * Creates a flat array of symbol nodes from tokens.
     431     *
     432     * @param {FrontCalculatorParserToken[]} tokens
     433     * @returns {FrontCalculatorParserNodeSymbol[]}
     434     */
     435  }, {
     436    key: "detectSymbols",
     437    value: function detectSymbols(tokens) {
     438      var symbolNodes = [];
     439      var symbol = null;
     440      var identifier = null;
     441      var expectingOpeningBracket = false; // True if we expect an opening bracket (after a function name)
     442      var openBracketCounter = 0;
     443      for (var i = 0; i < tokens.length; i++) {
     444        var token = tokens[i];
     445        var type = token.type;
     446        if (_frontCalculatorParser.default.TYPE_WORD === type) {
     447          identifier = token.value;
     448          symbol = this.symbolLoader.find(identifier);
     449          if (null === symbol) {
     450            throw 'Error: Detected unknown or invalid string identifier: ' + identifier + '.';
     451          }
     452        } else if (type === _frontCalculatorParser.default.TYPE_NUMBER) {
     453          // Notice: Numbers do not have an identifier
     454          var symbolNumbers = this.symbolLoader.findSubTypes(_frontCalculatorSymbol.default);
     455          if (symbolNumbers.length < 1 || !(symbolNumbers instanceof Array)) {
     456            throw 'Error: Unavailable number symbol processor.';
     457          }
     458          symbol = symbolNumbers[0];
     459        } else {
     460          // Type Token::TYPE_CHARACTER:
     461          identifier = token.value;
     462          symbol = this.symbolLoader.find(identifier);
     463          if (null === symbol) {
     464            throw 'Error: Detected unknown or invalid string identifier: ' + identifier + '.';
     465          }
     466          if (symbol instanceof _frontCalculatorSymbolOpening.default) {
     467            openBracketCounter++;
     468          }
     469          if (symbol instanceof _frontCalculatorSymbolClosing.default) {
     470            openBracketCounter--;
     471
     472            // Make sure there are not too many closing brackets
     473            if (openBracketCounter < 0) {
     474              throw 'Error: Found closing bracket that does not have an opening bracket.';
     475            }
     476          }
     477        }
     478        if (expectingOpeningBracket) {
     479          if (!(symbol instanceof _frontCalculatorSymbolOpening.default)) {
     480            throw 'Error: Expected opening bracket (after a function) but got something else.';
     481          }
     482          expectingOpeningBracket = false;
     483        } else {
     484          if (symbol instanceof _frontCalculatorSymbolFunction.default) {
     485            expectingOpeningBracket = true;
     486          }
     487        }
     488        var symbolNode = new _frontCalculatorParserNode.default(token, symbol);
     489        symbolNodes.push(symbolNode);
     490      }
     491
     492      // Make sure the term does not end with the name of a function but without an opening bracket
     493      if (expectingOpeningBracket) {
     494        throw 'Error: Expected opening bracket (after a function) but reached the end of the term';
     495      }
     496
     497      // Make sure there are not too many opening brackets
     498      if (openBracketCounter > 0) {
     499        throw 'Error: There is at least one opening bracket that does not have a closing bracket';
     500      }
     501      return symbolNodes;
     502    }
     503
     504    /**
     505     * Expects a flat array of symbol nodes and (if possible) transforms
     506     * it to a tree of nodes. Cares for brackets.
     507     * Attention: Expects valid brackets!
     508     * Check the brackets before you call this method.
     509     *
     510     * @param {FrontCalculatorParserNodeSymbol[]} symbolNodes
     511     * @returns {FrontCalculatorParserNodeAbstract[]}
     512     */
     513  }, {
     514    key: "createTreeByBrackets",
     515    value: function createTreeByBrackets(symbolNodes) {
     516      var tree = [];
     517      var nodesInBracket = []; // AbstractSymbol nodes inside level-0-brackets
     518      var openBracketCounter = 0;
     519      for (var i = 0; i < symbolNodes.length; i++) {
     520        var symbolNode = symbolNodes[i];
     521        if (!(symbolNode instanceof _frontCalculatorParserNode.default)) {
     522          throw 'Error: Expected symbol node, but got "' + symbolNode.constructor.name + '"';
     523        }
     524        if (symbolNode.symbol instanceof _frontCalculatorSymbolOpening.default) {
     525          openBracketCounter++;
     526          if (openBracketCounter > 1) {
     527            nodesInBracket.push(symbolNode);
     528          }
     529        } else if (symbolNode.symbol instanceof _frontCalculatorSymbolClosing.default) {
     530          openBracketCounter--;
     531
     532          // Found a closing bracket on level 0
     533          if (0 === openBracketCounter) {
     534            var subTree = this.createTreeByBrackets(nodesInBracket);
     535
     536            // Subtree can be empty for example if the term looks like this: "()" or "functioname()"
     537            // But this is okay, we need to allow this so we can call functions without a parameter
     538            tree.push(new _frontCalculatorParserNode2.default(subTree));
     539            nodesInBracket = [];
     540          } else {
     541            nodesInBracket.push(symbolNode);
     542          }
     543        } else {
     544          if (0 === openBracketCounter) {
     545            tree.push(symbolNode);
     546          } else {
     547            nodesInBracket.push(symbolNode);
     548          }
     549        }
     550      }
     551      return tree;
     552    }
     553
     554    /**
     555     * Replaces [a SymbolNode that has a symbol of type AbstractFunction,
     556     * followed by a node of type ContainerNode] by a FunctionNode.
     557     * Expects the $nodes not including any function nodes (yet).
     558     *
     559     * @param {FrontCalculatorParserNodeAbstract[]} nodes
     560     *
     561     * @returns {FrontCalculatorParserNodeAbstract[]}
     562     */
     563  }, {
     564    key: "transformTreeByFunctions",
     565    value: function transformTreeByFunctions(nodes) {
     566      var transformedNodes = [];
     567      var functionSymbolNode = null;
     568      for (var i = 0; i < nodes.length; i++) {
     569        var node = nodes[i];
     570        if (node instanceof _frontCalculatorParserNode2.default) {
     571          var transformedChildNodes = this.transformTreeByFunctions(node.childNodes);
     572          if (null !== functionSymbolNode) {
     573            var functionNode = new _frontCalculatorParserNode3.default(transformedChildNodes, functionSymbolNode);
     574            transformedNodes.push(functionNode);
     575            functionSymbolNode = null;
     576          } else {
     577            // not a function
     578            node.childNodes = transformedChildNodes;
     579            transformedNodes.push(node);
     580          }
     581        } else if (node instanceof _frontCalculatorParserNode.default) {
     582          var symbol = node.symbol;
     583          if (symbol instanceof _frontCalculatorSymbolFunction.default) {
     584            functionSymbolNode = node;
     585          } else {
     586            transformedNodes.push(node);
     587          }
     588        } else {
     589          throw 'Error: Expected array node or symbol node, got "' + node.constructor.name + '"';
     590        }
     591      }
     592      return transformedNodes;
     593    }
     594
     595    /**
     596     * Ensures the tree follows the grammar rules for terms
     597     *
     598     * @param {FrontCalculatorParserNodeAbstract[]} nodes
     599     */
     600  }, {
     601    key: "checkGrammar",
     602    value: function checkGrammar(nodes) {
     603      // TODO Make sure that separators are only in the child nodes of the array node of a function node
     604      // (If this happens the calculator will throw an exception)
     605
     606      for (var i = 0; i < nodes.length; i++) {
     607        var node = nodes[i];
     608        if (node instanceof _frontCalculatorParserNode.default) {
     609          var symbol = node.symbol;
     610          if (symbol instanceof _frontCalculatorSymbolOperator.default) {
     611            var posOfRightOperand = i + 1;
     612
     613            // Make sure the operator is positioned left of a (potential) operand (=prefix notation).
     614            // Example term: "-1"
     615            if (posOfRightOperand >= nodes.length) {
     616              throw 'Error: Found operator that does not stand before an operand.';
     617            }
     618            var posOfLeftOperand = i - 1;
     619            var leftOperand = null;
     620
     621            // Operator is unary if positioned at the beginning of a term
     622            if (posOfLeftOperand >= 0) {
     623              leftOperand = nodes[posOfLeftOperand];
     624              if (leftOperand instanceof _frontCalculatorParserNode.default) {
     625                if (leftOperand.symbol instanceof _frontCalculatorSymbolOperator.default // example 1`+-`5 : + = operator, - = unary
     626                || leftOperand.symbol instanceof _frontCalculatorSymbol2.default // example func(1`,-`5) ,= separator, - = unary
     627                ) {
     628                  // Operator is unary if positioned right to another operator
     629                  leftOperand = null;
     630                }
     631              }
     632            }
     633
     634            // If null, the operator is unary
     635            if (null === leftOperand) {
     636              if (!symbol.operatesUnary) {
     637                throw 'Error: Found operator in unary notation that is not unary.';
     638              }
     639
     640              // Remember that this node represents a unary operator
     641              node.setIsUnaryOperator(true);
     642            } else {
     643              if (!symbol.operatesBinary) {
     644                console.log(symbol);
     645                throw 'Error: Found operator in binary notation that is not binary.';
     646              }
     647            }
     648          }
     649        } else {
     650          this.checkGrammar(node.childNodes);
     651        }
     652      }
     653    }
     654  }]);
     655  return FrontCalculatorParser;
     656}();
     657
     658},{"../symbol/abstract/front.calculator.symbol.function.abstract":11,"../symbol/abstract/front.calculator.symbol.operator.abstract":12,"../symbol/brackets/front.calculator.symbol.closing.bracket":13,"../symbol/brackets/front.calculator.symbol.opening.bracket":14,"../symbol/front.calculator.symbol.number":17,"../symbol/front.calculator.symbol.separator":18,"./front.calculator.parser.token":3,"./node/front.calculator.parser.node.container":6,"./node/front.calculator.parser.node.function":7,"./node/front.calculator.parser.node.symbol":8}],3:[function(require,module,exports){
     659"use strict";
     660
     661Object.defineProperty(exports, "__esModule", {
     662  value: true
     663});
     664exports.default = void 0;
     665function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     666function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     667function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     668function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     669function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     670function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     671var FrontCalculatorParserToken = exports.default = /*#__PURE__*/function () {
     672  function FrontCalculatorParserToken(type, value, position) {
     673    _classCallCheck(this, FrontCalculatorParserToken);
     674    /**
     675     *
     676     * @type {Number}
     677     */
     678    this.type = type;
     679
     680    /**
     681     *
     682     * @type {String|Number}
     683     */
     684    this.value = value;
     685
     686    /**
     687     *
     688     * @type {Number}
     689     */
     690    this.position = position;
     691  }
     692  _createClass(FrontCalculatorParserToken, null, [{
     693    key: "TYPE_WORD",
     694    get: function get() {
     695      return 1;
     696    }
     697  }, {
     698    key: "TYPE_CHAR",
     699    get: function get() {
     700      return 2;
     701    }
     702  }, {
     703    key: "TYPE_NUMBER",
     704    get: function get() {
     705      return 3;
     706    }
     707  }]);
     708  return FrontCalculatorParserToken;
     709}();
     710
     711},{}],4:[function(require,module,exports){
     712"use strict";
     713
     714Object.defineProperty(exports, "__esModule", {
     715  value: true
     716});
     717exports.default = void 0;
     718var _frontCalculatorParser = _interopRequireDefault(require("./front.calculator.parser.token"));
     719function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     720function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     721function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     722function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     723function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     724function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     725function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     726var FrontCalculatorParserTokenizer = exports.default = /*#__PURE__*/function () {
     727  function FrontCalculatorParserTokenizer(input) {
     728    _classCallCheck(this, FrontCalculatorParserTokenizer);
     729    /**
     730     *
     731     * @type {String}
     732     */
     733    this.input = input;
     734
     735    /**
     736     * @type {number}
     737     */
     738    this.currentPosition = 0;
     739  }
     740
     741  /**
     742   *
     743   * @returns {FrontCalculatorParserToken[]}
     744   */
     745  _createClass(FrontCalculatorParserTokenizer, [{
     746    key: "tokenize",
     747    value: function tokenize() {
     748      this.reset();
     749      var tokens = [];
     750      var token = this.readToken();
     751      while (token) {
     752        tokens.push(token);
     753        token = this.readToken();
     754      }
     755      return tokens;
     756    }
     757
     758    /**
     759     *
     760     * @returns {FrontCalculatorParserToken}
     761     */
     762  }, {
     763    key: "readToken",
     764    value: function readToken() {
     765      this.stepOverWhitespace();
     766      var char = this.readCurrent();
     767      if (null === char) {
     768        return null;
     769      }
     770      var value = null;
     771      var type = null;
     772      if (this.isLetter(char)) {
     773        value = this.readWord();
     774        type = _frontCalculatorParser.default.TYPE_WORD;
     775      } else if (this.isDigit(char) || this.isPeriod(char)) {
     776        value = this.readNumber();
     777        type = _frontCalculatorParser.default.TYPE_NUMBER;
     778      } else {
     779        value = this.readChar();
     780        type = _frontCalculatorParser.default.TYPE_CHAR;
     781      }
     782      return new _frontCalculatorParser.default(type, value, this.currentPosition);
     783    }
     784
     785    /**
     786     * Returns true, if a given character is a letter (a-z and A-Z).
     787     *
     788     * @param char
     789     * @returns {boolean}
     790     */
     791  }, {
     792    key: "isLetter",
     793    value: function isLetter(char) {
     794      if (null === char) {
     795        return false;
     796      }
     797      var ascii = char.charCodeAt(0);
     798
     799      /**
     800       * ASCII codes: 65 = 'A', 90 = 'Z', 97 = 'a', 122 = 'z'--
     801       **/
     802      return ascii >= 65 && ascii <= 90 || ascii >= 97 && ascii <= 122;
     803    }
     804
     805    /**
     806     * Returns true, if a given character is a digit (0-9).
     807     *
     808     * @param char
     809     * @returns {boolean}
     810     */
     811  }, {
     812    key: "isDigit",
     813    value: function isDigit(char) {
     814      if (null === char) {
     815        return false;
     816      }
     817      var ascii = char.charCodeAt(0);
     818
     819      /**
     820       * ASCII codes: 48 = '0', 57 = '9'
     821       */
     822      return ascii >= 48 && ascii <= 57;
     823    }
     824
     825    /**
     826     * Returns true, if a given character is a period ('.').
     827     *
     828     * @param char
     829     * @returns {boolean}
     830     */
     831  }, {
     832    key: "isPeriod",
     833    value: function isPeriod(char) {
     834      return '.' === char;
     835    }
     836
     837    /**
     838     * Returns true, if a given character is whitespace.
     839     * Notice: A null char is not seen as whitespace.
     840     *
     841     * @param char
     842     * @returns {boolean}
     843     */
     844  }, {
     845    key: "isWhitespace",
     846    value: function isWhitespace(char) {
     847      return [" ", "\t", "\n"].indexOf(char) >= 0;
     848    }
     849  }, {
     850    key: "stepOverWhitespace",
     851    value: function stepOverWhitespace() {
     852      while (this.isWhitespace(this.readCurrent())) {
     853        this.readNext();
     854      }
     855    }
     856
     857    /**
     858     * Reads a word. Assumes that the cursor of the input stream
     859     * currently is positioned at the beginning of a word.
     860     *
     861     * @returns {string}
     862     */
     863  }, {
     864    key: "readWord",
     865    value: function readWord() {
     866      var word = '';
     867      var char = this.readCurrent();
     868      // Try to read the word
     869      while (null !== char) {
     870        if (this.isLetter(char)) {
     871          word += char;
     872        } else {
     873          break;
     874        }
     875
     876        // Just move the cursor to the next position
     877        char = this.readNext();
     878      }
     879      return word;
     880    }
     881
     882    /**
     883     * Reads a number (as a string). Assumes that the cursor
     884     * of the input stream currently is positioned at the
     885     * beginning of a number.
     886     *
     887     * @returns {string}
     888     */
     889  }, {
     890    key: "readNumber",
     891    value: function readNumber() {
     892      var number = '';
     893      var foundPeriod = false;
     894
     895      // Try to read the number.
     896      // Notice: It does not matter if the number only consists of a single period
     897      // or if it ends with a period.
     898      var char = this.readCurrent();
     899      while (null !== char) {
     900        if (this.isPeriod(char) || this.isDigit(char)) {
     901          if (this.isPeriod(char)) {
     902            if (foundPeriod) {
     903              throw 'Error: A number cannot have more than one period';
     904            }
     905            foundPeriod = true;
     906          }
     907          number += char;
     908        } else {
     909          break;
     910        }
     911
     912        // read next
     913        char = this.readNext();
     914      }
     915      return number;
     916    }
     917
     918    /**
     919     * Reads a single char. Assumes that the cursor of the input stream
     920     * currently is positioned at a char (not on null).
     921     *
     922     * @returns {String}
     923     */
     924  }, {
     925    key: "readChar",
     926    value: function readChar() {
     927      var char = this.readCurrent();
     928      // Just move the cursor to the next position
     929      this.readNext();
     930      return char;
     931    }
     932
     933    /**
     934     *
     935     * @returns {String|null}
     936     */
     937  }, {
     938    key: "readCurrent",
     939    value: function readCurrent() {
     940      var char = null;
     941      if (this.hasCurrent()) {
     942        char = this.input[this.currentPosition];
     943      }
     944      return char;
     945    }
     946
     947    /**
     948     * Move the the cursor to the next position.
     949     * Will always move the cursor, even if the end of the string has been passed.
     950     *
     951     * @returns {String}
     952     */
     953  }, {
     954    key: "readNext",
     955    value: function readNext() {
     956      this.currentPosition++;
     957      return this.readCurrent();
     958    }
     959
     960    /**
     961     * Returns true if there is a character at the current position
     962     *
     963     * @returns {boolean}
     964     */
     965  }, {
     966    key: "hasCurrent",
     967    value: function hasCurrent() {
     968      return this.currentPosition < this.input.length;
     969    }
     970  }, {
     971    key: "reset",
     972    value: function reset() {
     973      this.currentPosition = 0;
     974    }
     975  }]);
     976  return FrontCalculatorParserTokenizer;
     977}();
     978
     979},{"./front.calculator.parser.token":3}],5:[function(require,module,exports){
     980"use strict";
     981
     982function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     983Object.defineProperty(exports, "__esModule", {
     984  value: true
     985});
     986exports.default = void 0;
     987function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     988function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     989function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     990function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     991function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     992var FrontCalculatorParserNodeAbstract = exports.default = /*#__PURE__*/_createClass(function FrontCalculatorParserNodeAbstract() {
     993  _classCallCheck(this, FrontCalculatorParserNodeAbstract);
     994});
     995
     996},{}],6:[function(require,module,exports){
     997"use strict";
     998
     999function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1000Object.defineProperty(exports, "__esModule", {
     1001  value: true
     1002});
     1003exports.default = void 0;
     1004var _frontCalculatorParserNode = _interopRequireDefault(require("./front.calculator.parser.node.abstract"));
     1005function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1006function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1007function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1008function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1009function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1010function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1011function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1012function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1013function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1014function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1015function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1016function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1017function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1018/**
     1019 * A parent node is a container for a (sorted) array of nodes.
     1020 *
     1021 */
     1022var FrontCalculatorParserNodeContainer = exports.default = /*#__PURE__*/function (_FrontCalculatorParse) {
     1023  _inherits(FrontCalculatorParserNodeContainer, _FrontCalculatorParse);
     1024  var _super = _createSuper(FrontCalculatorParserNodeContainer);
     1025  function FrontCalculatorParserNodeContainer(childNodes) {
     1026    var _this;
     1027    _classCallCheck(this, FrontCalculatorParserNodeContainer);
     1028    _this = _super.call(this);
     1029
     1030    /**
     1031     *
     1032     * @type {FrontCalculatorParserNodeAbstract[]}
     1033     */
     1034    _this.childNodes = null;
     1035    _this.setChildNodes(childNodes);
     1036    return _this;
     1037  }
     1038
     1039  /**
     1040   * Setter for the child nodes.
     1041   * Notice: The number of child nodes can be 0.
     1042   * @param childNodes
     1043   */
     1044  _createClass(FrontCalculatorParserNodeContainer, [{
     1045    key: "setChildNodes",
     1046    value: function setChildNodes(childNodes) {
     1047      childNodes.forEach(function (childNode) {
     1048        if (!(childNode instanceof _frontCalculatorParserNode.default)) {
     1049          throw 'Expected AbstractNode, but got ' + childNode.constructor.name;
     1050        }
     1051      });
     1052      this.childNodes = childNodes;
     1053    }
     1054
     1055    /**
     1056     * Returns the number of child nodes in this array node.
     1057     * Does not count the child nodes of the child nodes.
     1058     *
     1059     * @returns {number}
     1060     */
     1061  }, {
     1062    key: "size",
     1063    value: function size() {
     1064      try {
     1065        return this.childNodes.length;
     1066      } catch (e) {
     1067        return 0;
     1068      }
     1069    }
     1070
     1071    /**
     1072     * Returns true if the array node does not have any
     1073     * child nodes. This might sound strange but is possible.
     1074     *
     1075     * @returns {boolean}
     1076     */
     1077  }, {
     1078    key: "isEmpty",
     1079    value: function isEmpty() {
     1080      return !this.size();
     1081    }
     1082  }]);
     1083  return FrontCalculatorParserNodeContainer;
     1084}(_frontCalculatorParserNode.default);
     1085
     1086},{"./front.calculator.parser.node.abstract":5}],7:[function(require,module,exports){
     1087"use strict";
     1088
     1089function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1090Object.defineProperty(exports, "__esModule", {
     1091  value: true
     1092});
     1093exports.default = void 0;
     1094var _frontCalculatorParserNode = _interopRequireDefault(require("./front.calculator.parser.node.container"));
     1095function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1096function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1097function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1098function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1099function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1100function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1101function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1102function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1103function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1104function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1105function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1106function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1107function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1108/**
     1109 * A function in a term consists of the name of the function
     1110 * (the symbol of the function) and the brackets that follow
     1111 * the name and everything that is in this brackets (the
     1112 * arguments). A function node combines these two things.
     1113 * It stores its symbol in the $symbolNode property and its
     1114 * arguments in the $childNodes property which is inherited
     1115 * from the ContainerNode class.
     1116 *
     1117 */
     1118var FrontCalculatorParserNodeFunction = exports.default = /*#__PURE__*/function (_FrontCalculatorParse) {
     1119  _inherits(FrontCalculatorParserNodeFunction, _FrontCalculatorParse);
     1120  var _super = _createSuper(FrontCalculatorParserNodeFunction);
     1121  /**
     1122   * ContainerNode constructor.
     1123   * Attention: The constructor is differs from the constructor
     1124   * of the parent class!
     1125   *
     1126   * @param childNodes
     1127   * @param symbolNode
     1128   */
     1129  function FrontCalculatorParserNodeFunction(childNodes, symbolNode) {
     1130    var _this;
     1131    _classCallCheck(this, FrontCalculatorParserNodeFunction);
     1132    _this = _super.call(this, childNodes);
     1133
     1134    /**
     1135     *
     1136     * @type {FrontCalculatorParserNodeSymbol}
     1137     */
     1138    _this.symbolNode = symbolNode;
     1139    return _this;
     1140  }
     1141  return _createClass(FrontCalculatorParserNodeFunction);
     1142}(_frontCalculatorParserNode.default);
     1143
     1144},{"./front.calculator.parser.node.container":6}],8:[function(require,module,exports){
     1145"use strict";
     1146
     1147function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1148Object.defineProperty(exports, "__esModule", {
     1149  value: true
     1150});
     1151exports.default = void 0;
     1152var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../../symbol/abstract/front.calculator.symbol.operator.abstract"));
     1153var _frontCalculatorParserNode = _interopRequireDefault(require("./front.calculator.parser.node.abstract"));
     1154function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1155function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1156function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1157function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1158function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1159function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1160function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1161function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1162function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1163function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1164function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1165function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1166function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1167/**
     1168 * A symbol node is a node in the syntax tree.
     1169 * Leaf nodes do not have any child nodes
     1170 * (parent nodes can have child nodes). A
     1171 * symbol node represents a mathematical symbol.
     1172 * Nodes are created by the parser.
     1173 *
     1174 */
     1175var FrontCalculatorParserNodeSymbol = exports.default = /*#__PURE__*/function (_FrontCalculatorParse) {
     1176  _inherits(FrontCalculatorParserNodeSymbol, _FrontCalculatorParse);
     1177  var _super = _createSuper(FrontCalculatorParserNodeSymbol);
     1178  function FrontCalculatorParserNodeSymbol(token, symbol) {
     1179    var _this;
     1180    _classCallCheck(this, FrontCalculatorParserNodeSymbol);
     1181    _this = _super.call(this);
     1182
     1183    /**
     1184     * The token of the node. It contains the value.
     1185     *
     1186     * @type {FrontCalculatorParserToken}
     1187     */
     1188    _this.token = token;
     1189
     1190    /**
     1191     * The symbol of the node. It defines the type of the node.
     1192     *
     1193     * @type {FrontCalculatorSymbolAbstract}
     1194     */
     1195    _this.symbol = symbol;
     1196
     1197    /**
     1198     * Unary operators need to be treated specially.
     1199     * Therefore a node has to know if it (or to be
     1200     * more precise the symbol of the node)
     1201     * represents a unary operator.
     1202     * Example : -1, -4
     1203     *
     1204     * @type {boolean}
     1205     */
     1206    _this.isUnaryOperator = false;
     1207    return _this;
     1208  }
     1209  _createClass(FrontCalculatorParserNodeSymbol, [{
     1210    key: "setIsUnaryOperator",
     1211    value: function setIsUnaryOperator(isUnaryOperator) {
     1212      if (!(this.symbol instanceof _frontCalculatorSymbolOperator.default)) {
     1213        throw 'Error: Cannot mark node as unary operator, because symbol is not an operator but of type ' + this.symbol.constructor.name;
     1214      }
     1215      this.isUnaryOperator = isUnaryOperator;
     1216    }
     1217  }]);
     1218  return FrontCalculatorParserNodeSymbol;
     1219}(_frontCalculatorParserNode.default);
     1220
     1221},{"../../symbol/abstract/front.calculator.symbol.operator.abstract":12,"./front.calculator.parser.node.abstract":5}],9:[function(require,module,exports){
     1222"use strict";
     1223
     1224Object.defineProperty(exports, "__esModule", {
     1225  value: true
     1226});
     1227exports.default = void 0;
     1228function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1229function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1230function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1231function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1232function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1233function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1234var FrontCalculatorSymbolAbstract = exports.default = /*#__PURE__*/function () {
     1235  function FrontCalculatorSymbolAbstract() {
     1236    _classCallCheck(this, FrontCalculatorSymbolAbstract);
     1237    /**
     1238     * Array with the 1-n (exception: the Numbers class may have 0)
     1239     * unique identifiers (the textual representation of a symbol)
     1240     * of the symbol. Example: ['/', ':']
     1241     * Attention: The identifiers are case-sensitive, however,
     1242     * valid identifiers in a term are always written in lower-case.
     1243     * Therefore identifiers always have to be written in lower-case!
     1244     *
     1245     * @type {String[]}
     1246     */
     1247    this.identifiers = [];
     1248  }
     1249
     1250  /**
     1251   * Getter for the identifiers of the symbol.
     1252   * Attention: The identifiers will be lower-cased!
     1253   * @returns {String[]}
     1254   */
     1255  _createClass(FrontCalculatorSymbolAbstract, [{
     1256    key: "getIdentifiers",
     1257    value: function getIdentifiers() {
     1258      var lowerIdentifiers = [];
     1259      this.identifiers.forEach(function (identifier) {
     1260        lowerIdentifiers.push(identifier.toLowerCase());
     1261      });
     1262      return lowerIdentifiers;
     1263    }
     1264  }]);
     1265  return FrontCalculatorSymbolAbstract;
     1266}();
     1267
     1268},{}],10:[function(require,module,exports){
     1269"use strict";
     1270
     1271function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1272Object.defineProperty(exports, "__esModule", {
     1273  value: true
     1274});
     1275exports.default = void 0;
     1276var _frontCalculatorSymbol = _interopRequireDefault(require("./front.calculator.symbol.abstract"));
     1277function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1278function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1279function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1280function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1281function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1282function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1283function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1284function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1285function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1286function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1287function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1288function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1289function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1290/**
     1291 * This class is the base class for all symbols that are of the type "constant".
     1292 * We recommend to use names as textual representations for this type of symbol.
     1293 * Please take note of the fact that the precision of PHP float constants
     1294 * (for example M_PI) is based on the "precision" directive in php.ini,
     1295 * which defaults to 14.
     1296 */
     1297var FrontCalculatorSymbolConstantAbstract = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1298  _inherits(FrontCalculatorSymbolConstantAbstract, _FrontCalculatorSymbo);
     1299  var _super = _createSuper(FrontCalculatorSymbolConstantAbstract);
     1300  function FrontCalculatorSymbolConstantAbstract() {
     1301    var _this;
     1302    _classCallCheck(this, FrontCalculatorSymbolConstantAbstract);
     1303    _this = _super.call(this);
     1304
     1305    /**
     1306     * This is the value of the constant. We use 0 as an example here,
     1307     * but you are supposed to overwrite this in the concrete constant class.
     1308     * Usually mathematical constants are not integers, however,
     1309     * you are allowed to use an integer in this context.
     1310     *
     1311     * @type {number}
     1312     */
     1313    _this.value = 0;
     1314    return _this;
     1315  }
     1316  return _createClass(FrontCalculatorSymbolConstantAbstract);
     1317}(_frontCalculatorSymbol.default);
     1318
     1319},{"./front.calculator.symbol.abstract":9}],11:[function(require,module,exports){
     1320"use strict";
     1321
     1322function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1323Object.defineProperty(exports, "__esModule", {
     1324  value: true
     1325});
     1326exports.default = void 0;
     1327var _frontCalculatorSymbol = _interopRequireDefault(require("./front.calculator.symbol.abstract"));
     1328function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1329function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1330function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1331function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1332function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1333function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1334function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1335function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1336function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1337function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1338function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1339function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1340function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1341/**
     1342 * This class is the base class for all symbols that are of the type "function".
     1343 * Typically the textual representation of a function consists of two or more letters.
     1344 */
     1345var FrontCalculatorSymbolFunctionAbstract = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1346  _inherits(FrontCalculatorSymbolFunctionAbstract, _FrontCalculatorSymbo);
     1347  var _super = _createSuper(FrontCalculatorSymbolFunctionAbstract);
     1348  function FrontCalculatorSymbolFunctionAbstract() {
     1349    _classCallCheck(this, FrontCalculatorSymbolFunctionAbstract);
     1350    return _super.call(this);
     1351  }
     1352
     1353  /**
     1354   * This method is called when the function is executed. A function can have 0-n parameters.
     1355   * The implementation of this method is responsible to validate the number of arguments.
     1356   * The $arguments array contains these arguments. If the number of arguments is improper,
     1357   * the method has to throw a Exceptions\NumberOfArgumentsException exception.
     1358   * The items of the $arguments array will always be of type int or float. They will never be null.
     1359   * They keys will be integers starting at 0 and representing the positions of the arguments
     1360   * in ascending order.
     1361   * Overwrite this method in the concrete operator class.
     1362   * If this class does NOT return a value of type int or float,
     1363   * an exception will be thrown.
     1364   *
     1365   * @param {int[]|float[]} params
     1366   * @returns {number}
     1367   */
     1368  _createClass(FrontCalculatorSymbolFunctionAbstract, [{
     1369    key: "execute",
     1370    value: function execute(params) {
     1371      return 0.0;
     1372    }
     1373  }]);
     1374  return FrontCalculatorSymbolFunctionAbstract;
     1375}(_frontCalculatorSymbol.default);
     1376
     1377},{"./front.calculator.symbol.abstract":9}],12:[function(require,module,exports){
     1378"use strict";
     1379
     1380function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1381Object.defineProperty(exports, "__esModule", {
     1382  value: true
     1383});
     1384exports.default = void 0;
     1385var _frontCalculatorSymbol = _interopRequireDefault(require("./front.calculator.symbol.abstract"));
     1386function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1387function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1388function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1389function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1390function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1391function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1392function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1393function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1394function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1395function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1396function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1397function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1398function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1399/**
     1400 * This class is the base class for all symbols that are of the type "(binary) operator".
     1401 * The textual representation of an operator consists of a single char that is not a letter.
     1402 * It is worth noting that a operator has the same power as a function with two parameters.
     1403 * Operators are always binary. To mimic a unary operator you might want to create a function
     1404 * that accepts one parameter.
     1405 */
     1406var FrontCalculatorSymbolOperatorAbstract = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1407  _inherits(FrontCalculatorSymbolOperatorAbstract, _FrontCalculatorSymbo);
     1408  var _super = _createSuper(FrontCalculatorSymbolOperatorAbstract);
     1409  function FrontCalculatorSymbolOperatorAbstract() {
     1410    var _this;
     1411    _classCallCheck(this, FrontCalculatorSymbolOperatorAbstract);
     1412    _this = _super.call(this);
     1413
     1414    /**
     1415     * The operator precedence determines which operators to perform first
     1416     * in order to evaluate a given term.
     1417     * You are supposed to overwrite this constant in the concrete constant class.
     1418     * Take a look at other operator classes to see the precedences of the predefined operators.
     1419     * 0: default, > 0: higher, < 0: lower
     1420     *
     1421     * @type {number}
     1422     */
     1423    _this.precedence = 0;
     1424
     1425    /**
     1426     * Usually operators are binary, they operate on two operands (numbers).
     1427     * But some can operate on one operand (number). The operand of a unary
     1428     * operator is always positioned after the operator (=prefix notation).
     1429     * Good example: "-1" Bad Example: "1-"
     1430     * If you want to create a unary operator that operates on the left
     1431     * operand, you should use a function instead. Functions with one
     1432     * parameter execute unary operations in functional notation.
     1433     * Notice: Operators can be unary AND binary (but this is a rare case)
     1434     *
     1435     * @type {boolean}
     1436     */
     1437    _this.operatesUnary = false;
     1438
     1439    /**
     1440     * Usually operators are binary, they operate on two operands (numbers).
     1441     * Notice: Operators can be unary AND binary (but this is a rare case)
     1442     *
     1443     * @type {boolean}
     1444     */
     1445    _this.operatesBinary = true;
     1446    return _this;
     1447  }
     1448  _createClass(FrontCalculatorSymbolOperatorAbstract, [{
     1449    key: "operate",
     1450    value: function operate(leftNumber, rightNumber) {
     1451      return 0.0;
     1452    }
     1453  }]);
     1454  return FrontCalculatorSymbolOperatorAbstract;
     1455}(_frontCalculatorSymbol.default);
     1456
     1457},{"./front.calculator.symbol.abstract":9}],13:[function(require,module,exports){
     1458"use strict";
     1459
     1460function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1461Object.defineProperty(exports, "__esModule", {
     1462  value: true
     1463});
     1464exports.default = void 0;
     1465var _frontCalculatorSymbol = _interopRequireDefault(require("../abstract/front.calculator.symbol.abstract"));
     1466function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1467function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1468function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1469function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1470function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1471function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1472function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1473function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1474function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1475function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1476function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1477function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1478function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1479var FrontCalculatorSymbolClosingBracket = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1480  _inherits(FrontCalculatorSymbolClosingBracket, _FrontCalculatorSymbo);
     1481  var _super = _createSuper(FrontCalculatorSymbolClosingBracket);
     1482  function FrontCalculatorSymbolClosingBracket() {
     1483    var _this;
     1484    _classCallCheck(this, FrontCalculatorSymbolClosingBracket);
     1485    _this = _super.call(this);
     1486    _this.identifiers = [')'];
     1487    return _this;
     1488  }
     1489  return _createClass(FrontCalculatorSymbolClosingBracket);
     1490}(_frontCalculatorSymbol.default);
     1491
     1492},{"../abstract/front.calculator.symbol.abstract":9}],14:[function(require,module,exports){
     1493"use strict";
     1494
     1495function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1496Object.defineProperty(exports, "__esModule", {
     1497  value: true
     1498});
     1499exports.default = void 0;
     1500var _frontCalculatorSymbol = _interopRequireDefault(require("../abstract/front.calculator.symbol.abstract"));
     1501function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1502function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1503function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1504function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1505function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1506function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1507function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1508function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1509function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1510function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1511function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1512function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1513function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1514var FrontCalculatorSymbolOpeningBracket = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1515  _inherits(FrontCalculatorSymbolOpeningBracket, _FrontCalculatorSymbo);
     1516  var _super = _createSuper(FrontCalculatorSymbolOpeningBracket);
     1517  function FrontCalculatorSymbolOpeningBracket() {
     1518    var _this;
     1519    _classCallCheck(this, FrontCalculatorSymbolOpeningBracket);
     1520    _this = _super.call(this);
     1521    _this.identifiers = ['('];
     1522    return _this;
     1523  }
     1524  return _createClass(FrontCalculatorSymbolOpeningBracket);
     1525}(_frontCalculatorSymbol.default);
     1526
     1527},{"../abstract/front.calculator.symbol.abstract":9}],15:[function(require,module,exports){
     1528"use strict";
     1529
     1530function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1531Object.defineProperty(exports, "__esModule", {
     1532  value: true
     1533});
     1534exports.default = void 0;
     1535var _frontCalculatorSymbolConstant = _interopRequireDefault(require("../abstract/front.calculator.symbol.constant.abstract"));
     1536function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1537function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1538function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1539function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1540function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1541function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1542function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1543function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1544function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1545function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1546function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1547function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1548function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1549/**
     1550 * Math.PI
     1551 *
     1552 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/PI
     1553 */
     1554var FrontCalculatorSymbolConstantPi = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1555  _inherits(FrontCalculatorSymbolConstantPi, _FrontCalculatorSymbo);
     1556  var _super = _createSuper(FrontCalculatorSymbolConstantPi);
     1557  function FrontCalculatorSymbolConstantPi() {
     1558    var _this;
     1559    _classCallCheck(this, FrontCalculatorSymbolConstantPi);
     1560    _this = _super.call(this);
     1561    _this.identifiers = ['pi'];
     1562    _this.value = Math.PI;
     1563    return _this;
     1564  }
     1565  return _createClass(FrontCalculatorSymbolConstantPi);
     1566}(_frontCalculatorSymbolConstant.default);
     1567
     1568},{"../abstract/front.calculator.symbol.constant.abstract":10}],16:[function(require,module,exports){
     1569"use strict";
     1570
     1571Object.defineProperty(exports, "__esModule", {
     1572  value: true
     1573});
     1574exports.default = void 0;
     1575var _frontCalculatorSymbol = _interopRequireDefault(require("./front.calculator.symbol.number"));
     1576var _frontCalculatorSymbol2 = _interopRequireDefault(require("./front.calculator.symbol.separator"));
     1577var _frontCalculatorSymbolOpening = _interopRequireDefault(require("./brackets/front.calculator.symbol.opening.bracket"));
     1578var _frontCalculatorSymbolClosing = _interopRequireDefault(require("./brackets/front.calculator.symbol.closing.bracket"));
     1579var _frontCalculatorSymbolConstant = _interopRequireDefault(require("./constants/front.calculator.symbol.constant.pi"));
     1580var _frontCalculatorSymbolOperator = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.addition"));
     1581var _frontCalculatorSymbolOperator2 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.division"));
     1582var _frontCalculatorSymbolOperator3 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.exponentiation"));
     1583var _frontCalculatorSymbolOperator4 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.modulo"));
     1584var _frontCalculatorSymbolOperator5 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.multiplication"));
     1585var _frontCalculatorSymbolOperator6 = _interopRequireDefault(require("./operators/front.calculator.symbol.operator.subtraction"));
     1586var _frontCalculatorSymbolFunction = _interopRequireDefault(require("./functions/front.calculator.symbol.function.abs"));
     1587var _frontCalculatorSymbolFunction2 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.avg"));
     1588var _frontCalculatorSymbolFunction3 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.ceil"));
     1589var _frontCalculatorSymbolFunction4 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.floor"));
     1590var _frontCalculatorSymbolFunction5 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.max"));
     1591var _frontCalculatorSymbolFunction6 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.min"));
     1592var _frontCalculatorSymbolFunction7 = _interopRequireDefault(require("./functions/front.calculator.symbol.function.round"));
     1593function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1594function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1595function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1596function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1597function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1598function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1599function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1600var FrontCalculatorSymbolLoader = exports.default = /*#__PURE__*/function () {
     1601  function FrontCalculatorSymbolLoader() {
     1602    _classCallCheck(this, FrontCalculatorSymbolLoader);
     1603    /**
     1604     *
     1605     * @type {{FrontCalculatorSymbolOperatorModulo: FrontCalculatorSymbolOperatorModulo, FrontCalculatorSymbolOperatorSubtraction: FrontCalculatorSymbolOperatorSubtraction, FrontCalculatorSymbolOperatorExponentiation: FrontCalculatorSymbolOperatorExponentiation, FrontCalculatorSymbolOperatorAddition: FrontCalculatorSymbolOperatorAddition, FrontCalculatorSymbolClosingBracket: FrontCalculatorSymbolClosingBracket, FrontCalculatorSymbolFunctionMax: FrontCalculatorSymbolFunctionMax, FrontCalculatorSymbolFunctionCeil: FrontCalculatorSymbolFunctionCeil, FrontCalculatorSymbolSeparator: FrontCalculatorSymbolSeparator, FrontCalculatorSymbolOperatorMultiplication: FrontCalculatorSymbolOperatorMultiplication, FrontCalculatorSymbolFunctionAbs: FrontCalculatorSymbolFunctionAbs, FrontCalculatorSymbolFunctionAvg: FrontCalculatorSymbolFunctionAvg, FrontCalculatorSymbolFunctionFloor: FrontCalculatorSymbolFunctionFloor, FrontCalculatorSymbolFunctionMin: FrontCalculatorSymbolFunctionMin, FrontCalculatorSymbolOperatorDivision: FrontCalculatorSymbolOperatorDivision, FrontCalculatorSymbolNumber: FrontCalculatorSymbolNumber, FrontCalculatorSymbolOpeningBracket: FrontCalculatorSymbolOpeningBracket, FrontCalculatorSymbolConstantPi: FrontCalculatorSymbolConstantPi, FrontCalculatorSymbolFunctionRound: FrontCalculatorSymbolFunctionRound}}
     1606     */
     1607    this.symbols = {
     1608      FrontCalculatorSymbolNumber: new _frontCalculatorSymbol.default(),
     1609      FrontCalculatorSymbolSeparator: new _frontCalculatorSymbol2.default(),
     1610      FrontCalculatorSymbolOpeningBracket: new _frontCalculatorSymbolOpening.default(),
     1611      FrontCalculatorSymbolClosingBracket: new _frontCalculatorSymbolClosing.default(),
     1612      FrontCalculatorSymbolConstantPi: new _frontCalculatorSymbolConstant.default(),
     1613      FrontCalculatorSymbolOperatorAddition: new _frontCalculatorSymbolOperator.default(),
     1614      FrontCalculatorSymbolOperatorDivision: new _frontCalculatorSymbolOperator2.default(),
     1615      FrontCalculatorSymbolOperatorExponentiation: new _frontCalculatorSymbolOperator3.default(),
     1616      FrontCalculatorSymbolOperatorModulo: new _frontCalculatorSymbolOperator4.default(),
     1617      FrontCalculatorSymbolOperatorMultiplication: new _frontCalculatorSymbolOperator5.default(),
     1618      FrontCalculatorSymbolOperatorSubtraction: new _frontCalculatorSymbolOperator6.default(),
     1619      FrontCalculatorSymbolFunctionAbs: new _frontCalculatorSymbolFunction.default(),
     1620      FrontCalculatorSymbolFunctionAvg: new _frontCalculatorSymbolFunction2.default(),
     1621      FrontCalculatorSymbolFunctionCeil: new _frontCalculatorSymbolFunction3.default(),
     1622      FrontCalculatorSymbolFunctionFloor: new _frontCalculatorSymbolFunction4.default(),
     1623      FrontCalculatorSymbolFunctionMax: new _frontCalculatorSymbolFunction5.default(),
     1624      FrontCalculatorSymbolFunctionMin: new _frontCalculatorSymbolFunction6.default(),
     1625      FrontCalculatorSymbolFunctionRound: new _frontCalculatorSymbolFunction7.default()
     1626    };
     1627  }
     1628
     1629  /**
     1630   * Returns the symbol that has the given identifier.
     1631   * Returns null if none is found.
     1632   *
     1633   * @param identifier
     1634   * @returns {FrontCalculatorSymbolAbstract|null}
     1635   */
     1636  _createClass(FrontCalculatorSymbolLoader, [{
     1637    key: "find",
     1638    value: function find(identifier) {
     1639      identifier = identifier.toLowerCase();
     1640      for (var key in this.symbols) {
     1641        if (this.symbols.hasOwnProperty(key)) {
     1642          var symbol = this.symbols[key];
     1643          if (symbol.getIdentifiers().indexOf(identifier) >= 0) {
     1644            return symbol;
     1645          }
     1646        }
     1647      }
     1648      return null;
     1649    }
     1650
     1651    /**
     1652     * Returns all symbols that inherit from a given abstract
     1653     * parent type (class): The parent type has to be an
     1654     * AbstractSymbol.
     1655     * Notice: The parent type name will not be validated!
     1656     *
     1657     * @param parentTypeName
     1658     * @returns {FrontCalculatorSymbolAbstract[]}
     1659     */
     1660  }, {
     1661    key: "findSubTypes",
     1662    value: function findSubTypes(parentTypeName) {
     1663      var symbols = [];
     1664      for (var key in this.symbols) {
     1665        if (this.symbols.hasOwnProperty(key)) {
     1666          var symbol = this.symbols[key];
     1667          if (symbol instanceof parentTypeName) {
     1668            symbols.push(symbol);
     1669          }
     1670        }
     1671      }
     1672      return symbols;
     1673    }
     1674  }]);
     1675  return FrontCalculatorSymbolLoader;
     1676}();
     1677
     1678},{"./brackets/front.calculator.symbol.closing.bracket":13,"./brackets/front.calculator.symbol.opening.bracket":14,"./constants/front.calculator.symbol.constant.pi":15,"./front.calculator.symbol.number":17,"./front.calculator.symbol.separator":18,"./functions/front.calculator.symbol.function.abs":19,"./functions/front.calculator.symbol.function.avg":20,"./functions/front.calculator.symbol.function.ceil":21,"./functions/front.calculator.symbol.function.floor":22,"./functions/front.calculator.symbol.function.max":23,"./functions/front.calculator.symbol.function.min":24,"./functions/front.calculator.symbol.function.round":25,"./operators/front.calculator.symbol.operator.addition":26,"./operators/front.calculator.symbol.operator.division":27,"./operators/front.calculator.symbol.operator.exponentiation":28,"./operators/front.calculator.symbol.operator.modulo":29,"./operators/front.calculator.symbol.operator.multiplication":30,"./operators/front.calculator.symbol.operator.subtraction":31}],17:[function(require,module,exports){
     1679"use strict";
     1680
     1681function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1682Object.defineProperty(exports, "__esModule", {
     1683  value: true
     1684});
     1685exports.default = void 0;
     1686var _frontCalculatorSymbol = _interopRequireDefault(require("./abstract/front.calculator.symbol.abstract"));
     1687function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1688function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1689function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1690function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1691function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1692function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1693function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1694function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1695function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1696function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1697function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1698function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1699function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1700/**
     1701 * This class is the class that represents symbols of type "number".
     1702 * Numbers are completely handled by the tokenizer/parser so there is no need to
     1703 * create more than this concrete, empty number class that does not specify
     1704 * a textual representation of numbers (numbers always consist of digits
     1705 * and may include a single dot).
     1706 */
     1707var FrontCalculatorSymbolNumber = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1708  _inherits(FrontCalculatorSymbolNumber, _FrontCalculatorSymbo);
     1709  var _super = _createSuper(FrontCalculatorSymbolNumber);
     1710  function FrontCalculatorSymbolNumber() {
     1711    _classCallCheck(this, FrontCalculatorSymbolNumber);
     1712    return _super.call(this);
     1713  }
     1714  return _createClass(FrontCalculatorSymbolNumber);
     1715}(_frontCalculatorSymbol.default);
     1716
     1717},{"./abstract/front.calculator.symbol.abstract":9}],18:[function(require,module,exports){
     1718"use strict";
     1719
     1720function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1721Object.defineProperty(exports, "__esModule", {
     1722  value: true
     1723});
     1724exports.default = void 0;
     1725var _frontCalculatorSymbol = _interopRequireDefault(require("./abstract/front.calculator.symbol.abstract"));
     1726function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1727function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1728function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1729function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1730function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1731function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1732function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1733function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1734function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1735function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1736function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1737function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1738function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1739/**
     1740 * This class is a class that represents symbols of type "separator".
     1741 * A separator separates the arguments of a (mathematical) function.
     1742 * Most likely we will only need one concrete "separator" class.
     1743 */
     1744var FrontCalculatorSymbolSeparator = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1745  _inherits(FrontCalculatorSymbolSeparator, _FrontCalculatorSymbo);
     1746  var _super = _createSuper(FrontCalculatorSymbolSeparator);
     1747  function FrontCalculatorSymbolSeparator() {
     1748    var _this;
     1749    _classCallCheck(this, FrontCalculatorSymbolSeparator);
     1750    _this = _super.call(this);
     1751    _this.identifiers = [','];
     1752    return _this;
     1753  }
     1754  return _createClass(FrontCalculatorSymbolSeparator);
     1755}(_frontCalculatorSymbol.default);
     1756
     1757},{"./abstract/front.calculator.symbol.abstract":9}],19:[function(require,module,exports){
     1758"use strict";
     1759
     1760function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1761Object.defineProperty(exports, "__esModule", {
     1762  value: true
     1763});
     1764exports.default = void 0;
     1765var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract"));
     1766function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1767function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1768function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1769function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1770function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1771function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1772function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1773function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1774function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1775function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1776function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1777function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1778function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1779/**
     1780 * Math.abs() function. Expects one parameter.
     1781 * Example: "abs(2)" => 2, "abs(-2)" => 2, "abs(0)" => 0
     1782 *
     1783 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs
     1784 */
     1785var FrontCalculatorSymbolFunctionAbs = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1786  _inherits(FrontCalculatorSymbolFunctionAbs, _FrontCalculatorSymbo);
     1787  var _super = _createSuper(FrontCalculatorSymbolFunctionAbs);
     1788  function FrontCalculatorSymbolFunctionAbs() {
     1789    var _this;
     1790    _classCallCheck(this, FrontCalculatorSymbolFunctionAbs);
     1791    _this = _super.call(this);
     1792    _this.identifiers = ['abs'];
     1793    return _this;
     1794  }
     1795  _createClass(FrontCalculatorSymbolFunctionAbs, [{
     1796    key: "execute",
     1797    value: function execute(params) {
     1798      if (params.length !== 1) {
     1799        throw 'Error: Expected one argument, got ' + params.length;
     1800      }
     1801      var number = params[0];
     1802      return Math.abs(number);
     1803    }
     1804  }]);
     1805  return FrontCalculatorSymbolFunctionAbs;
     1806}(_frontCalculatorSymbolFunction.default);
     1807
     1808},{"../abstract/front.calculator.symbol.function.abstract":11}],20:[function(require,module,exports){
     1809"use strict";
     1810
     1811function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1812Object.defineProperty(exports, "__esModule", {
     1813  value: true
     1814});
     1815exports.default = void 0;
     1816var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract"));
     1817function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1818function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1819function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1820function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1821function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1822function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1823function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1824function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1825function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1826function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1827function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1828function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1829function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1830/**
     1831 * Math.abs() function. Expects one parameter.
     1832 * Example: "abs(2)" => 2, "abs(-2)" => 2, "abs(0)" => 0
     1833 *
     1834 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/abs
     1835 */
     1836var FrontCalculatorSymbolFunctionAvg = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1837  _inherits(FrontCalculatorSymbolFunctionAvg, _FrontCalculatorSymbo);
     1838  var _super = _createSuper(FrontCalculatorSymbolFunctionAvg);
     1839  function FrontCalculatorSymbolFunctionAvg() {
     1840    var _this;
     1841    _classCallCheck(this, FrontCalculatorSymbolFunctionAvg);
     1842    _this = _super.call(this);
     1843    _this.identifiers = ['avg'];
     1844    return _this;
     1845  }
     1846  _createClass(FrontCalculatorSymbolFunctionAvg, [{
     1847    key: "execute",
     1848    value: function execute(params) {
     1849      if (params.length < 1) {
     1850        throw 'Error: Expected at least one argument, got ' + params.length;
     1851      }
     1852      var sum = 0.0;
     1853      for (var i = 0; i < params.length; i++) {
     1854        sum += params[i];
     1855      }
     1856      return sum / params.length;
     1857    }
     1858  }]);
     1859  return FrontCalculatorSymbolFunctionAvg;
     1860}(_frontCalculatorSymbolFunction.default);
     1861
     1862},{"../abstract/front.calculator.symbol.function.abstract":11}],21:[function(require,module,exports){
     1863"use strict";
     1864
     1865function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1866Object.defineProperty(exports, "__esModule", {
     1867  value: true
     1868});
     1869exports.default = void 0;
     1870var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract"));
     1871function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1872function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1873function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1874function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1875function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1876function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1877function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1878function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1879function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1880function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1881function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1882function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1883function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1884/**
     1885 * Math.ceil() function aka round fractions up.
     1886 * Expects one parameter.
     1887 *
     1888 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/ceil
     1889 */
     1890var FrontCalculatorSymbolFunctionCeil = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1891  _inherits(FrontCalculatorSymbolFunctionCeil, _FrontCalculatorSymbo);
     1892  var _super = _createSuper(FrontCalculatorSymbolFunctionCeil);
     1893  function FrontCalculatorSymbolFunctionCeil() {
     1894    var _this;
     1895    _classCallCheck(this, FrontCalculatorSymbolFunctionCeil);
     1896    _this = _super.call(this);
     1897    _this.identifiers = ['ceil'];
     1898    return _this;
     1899  }
     1900  _createClass(FrontCalculatorSymbolFunctionCeil, [{
     1901    key: "execute",
     1902    value: function execute(params) {
     1903      if (params.length !== 1) {
     1904        throw 'Error: Expected one argument, got ' + params.length;
     1905      }
     1906      return Math.ceil(params[0]);
     1907    }
     1908  }]);
     1909  return FrontCalculatorSymbolFunctionCeil;
     1910}(_frontCalculatorSymbolFunction.default);
     1911
     1912},{"../abstract/front.calculator.symbol.function.abstract":11}],22:[function(require,module,exports){
     1913"use strict";
     1914
     1915function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1916Object.defineProperty(exports, "__esModule", {
     1917  value: true
     1918});
     1919exports.default = void 0;
     1920var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract"));
     1921function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1922function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1923function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1924function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1925function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1926function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1927function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1928function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1929function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1930function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1931function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1932function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1933function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1934/**
     1935 * Math.floor() function aka round fractions down.
     1936 * Expects one parameter.
     1937 *
     1938 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor
     1939 */
     1940var FrontCalculatorSymbolFunctionFloor = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1941  _inherits(FrontCalculatorSymbolFunctionFloor, _FrontCalculatorSymbo);
     1942  var _super = _createSuper(FrontCalculatorSymbolFunctionFloor);
     1943  function FrontCalculatorSymbolFunctionFloor() {
     1944    var _this;
     1945    _classCallCheck(this, FrontCalculatorSymbolFunctionFloor);
     1946    _this = _super.call(this);
     1947    _this.identifiers = ['floor'];
     1948    return _this;
     1949  }
     1950  _createClass(FrontCalculatorSymbolFunctionFloor, [{
     1951    key: "execute",
     1952    value: function execute(params) {
     1953      if (params.length !== 1) {
     1954        throw 'Error: Expected one argument, got ' + params.length;
     1955      }
     1956      return Math.floor(params[0]);
     1957    }
     1958  }]);
     1959  return FrontCalculatorSymbolFunctionFloor;
     1960}(_frontCalculatorSymbolFunction.default);
     1961
     1962},{"../abstract/front.calculator.symbol.function.abstract":11}],23:[function(require,module,exports){
     1963"use strict";
     1964
     1965function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     1966Object.defineProperty(exports, "__esModule", {
     1967  value: true
     1968});
     1969exports.default = void 0;
     1970var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract"));
     1971function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     1972function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
     1973function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
     1974function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
     1975function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
     1976function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
     1977function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
     1978function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     1979function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     1980function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     1981function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     1982function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     1983function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     1984function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     1985function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     1986function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     1987function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     1988function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     1989function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     1990/**
     1991 * Math.max() function. Expects at least one parameter.
     1992 * Example: "max(1,2,3)" => 3, "max(1,-1)" => 1, "max(0,0)" => 0, "max(2)" => 2
     1993 *
     1994 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/max
     1995 */
     1996var FrontCalculatorSymbolFunctionMax = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     1997  _inherits(FrontCalculatorSymbolFunctionMax, _FrontCalculatorSymbo);
     1998  var _super = _createSuper(FrontCalculatorSymbolFunctionMax);
     1999  function FrontCalculatorSymbolFunctionMax() {
     2000    var _this;
     2001    _classCallCheck(this, FrontCalculatorSymbolFunctionMax);
     2002    _this = _super.call(this);
     2003    _this.identifiers = ['max'];
     2004    return _this;
     2005  }
     2006  _createClass(FrontCalculatorSymbolFunctionMax, [{
     2007    key: "execute",
     2008    value: function execute(params) {
     2009      if (params.length < 1) {
     2010        throw 'Error: Expected at least one argument, got ' + params.length;
     2011      }
     2012      return Math.max.apply(Math, _toConsumableArray(params));
     2013    }
     2014  }]);
     2015  return FrontCalculatorSymbolFunctionMax;
     2016}(_frontCalculatorSymbolFunction.default);
     2017
     2018},{"../abstract/front.calculator.symbol.function.abstract":11}],24:[function(require,module,exports){
     2019"use strict";
     2020
     2021function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     2022Object.defineProperty(exports, "__esModule", {
     2023  value: true
     2024});
     2025exports.default = void 0;
     2026var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract"));
     2027function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     2028function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
     2029function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
     2030function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
     2031function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
     2032function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
     2033function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
     2034function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     2035function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     2036function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     2037function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     2038function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     2039function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     2040function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     2041function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     2042function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     2043function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     2044function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     2045function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     2046/**
     2047 * Math.min() function. Expects at least one parameter.
     2048 * Example: "min(1,2,3)" => 1, "min(1,-1)" => -1, "min(0,0)" => 0, "min(2)" => 2
     2049 *
     2050 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/min
     2051 */
     2052var FrontCalculatorSymbolFunctionMin = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     2053  _inherits(FrontCalculatorSymbolFunctionMin, _FrontCalculatorSymbo);
     2054  var _super = _createSuper(FrontCalculatorSymbolFunctionMin);
     2055  function FrontCalculatorSymbolFunctionMin() {
     2056    var _this;
     2057    _classCallCheck(this, FrontCalculatorSymbolFunctionMin);
     2058    _this = _super.call(this);
     2059    _this.identifiers = ['min'];
     2060    return _this;
     2061  }
     2062  _createClass(FrontCalculatorSymbolFunctionMin, [{
     2063    key: "execute",
     2064    value: function execute(params) {
     2065      if (params.length < 1) {
     2066        throw 'Error: Expected at least one argument, got ' + params.length;
     2067      }
     2068      return Math.min.apply(Math, _toConsumableArray(params));
     2069    }
     2070  }]);
     2071  return FrontCalculatorSymbolFunctionMin;
     2072}(_frontCalculatorSymbolFunction.default);
     2073
     2074},{"../abstract/front.calculator.symbol.function.abstract":11}],25:[function(require,module,exports){
     2075"use strict";
     2076
     2077function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     2078Object.defineProperty(exports, "__esModule", {
     2079  value: true
     2080});
     2081exports.default = void 0;
     2082var _frontCalculatorSymbolFunction = _interopRequireDefault(require("../abstract/front.calculator.symbol.function.abstract"));
     2083function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     2084function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     2085function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     2086function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     2087function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     2088function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     2089function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     2090function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     2091function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     2092function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     2093function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     2094function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     2095function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     2096/**
     2097 * Math.round() function aka rounds a float.
     2098 * Expects one parameter.
     2099 *
     2100 * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round
     2101 */
     2102var FrontCalculatorSymbolFunctionRound = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     2103  _inherits(FrontCalculatorSymbolFunctionRound, _FrontCalculatorSymbo);
     2104  var _super = _createSuper(FrontCalculatorSymbolFunctionRound);
     2105  function FrontCalculatorSymbolFunctionRound() {
     2106    var _this;
     2107    _classCallCheck(this, FrontCalculatorSymbolFunctionRound);
     2108    _this = _super.call(this);
     2109    _this.identifiers = ['round'];
     2110    return _this;
     2111  }
     2112  _createClass(FrontCalculatorSymbolFunctionRound, [{
     2113    key: "execute",
     2114    value: function execute(params) {
     2115      if (params.length !== 1) {
     2116        throw 'Error: Expected one argument, got ' + params.length;
     2117      }
     2118      return Math.round(params[0]);
     2119    }
     2120  }]);
     2121  return FrontCalculatorSymbolFunctionRound;
     2122}(_frontCalculatorSymbolFunction.default);
     2123
     2124},{"../abstract/front.calculator.symbol.function.abstract":11}],26:[function(require,module,exports){
     2125"use strict";
     2126
     2127function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     2128Object.defineProperty(exports, "__esModule", {
     2129  value: true
     2130});
     2131exports.default = void 0;
     2132var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract"));
     2133function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     2134function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     2135function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     2136function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     2137function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     2138function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     2139function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     2140function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     2141function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     2142function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     2143function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     2144function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     2145function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     2146/**
     2147 * Operator for mathematical addition.
     2148 * Example: "1+2" => 3
     2149 *
     2150 * @see     https://en.wikipedia.org/wiki/Addition
     2151 *
     2152 */
     2153var FrontCalculatorSymbolOperatorAddition = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     2154  _inherits(FrontCalculatorSymbolOperatorAddition, _FrontCalculatorSymbo);
     2155  var _super = _createSuper(FrontCalculatorSymbolOperatorAddition);
     2156  function FrontCalculatorSymbolOperatorAddition() {
     2157    var _this;
     2158    _classCallCheck(this, FrontCalculatorSymbolOperatorAddition);
     2159    _this = _super.call(this);
     2160    _this.identifiers = ['+'];
     2161    _this.precedence = 100;
     2162    return _this;
     2163  }
     2164  _createClass(FrontCalculatorSymbolOperatorAddition, [{
     2165    key: "operate",
     2166    value: function operate(leftNumber, rightNumber) {
     2167      return leftNumber + rightNumber;
     2168    }
     2169  }]);
     2170  return FrontCalculatorSymbolOperatorAddition;
     2171}(_frontCalculatorSymbolOperator.default);
     2172
     2173},{"../abstract/front.calculator.symbol.operator.abstract":12}],27:[function(require,module,exports){
     2174"use strict";
     2175
     2176function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     2177Object.defineProperty(exports, "__esModule", {
     2178  value: true
     2179});
     2180exports.default = void 0;
     2181var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract"));
     2182function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     2183function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     2184function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     2185function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     2186function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     2187function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     2188function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     2189function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     2190function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     2191function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     2192function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     2193function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     2194function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     2195/**
     2196 * Operator for mathematical division.
     2197 * Example: "6/2" => 3, "6/0" => PHP warning
     2198 *
     2199 * @see     https://en.wikipedia.org/wiki/Division_(mathematics)
     2200 *
     2201 */
     2202var FrontCalculatorSymbolOperatorDivision = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     2203  _inherits(FrontCalculatorSymbolOperatorDivision, _FrontCalculatorSymbo);
     2204  var _super = _createSuper(FrontCalculatorSymbolOperatorDivision);
     2205  function FrontCalculatorSymbolOperatorDivision() {
     2206    var _this;
     2207    _classCallCheck(this, FrontCalculatorSymbolOperatorDivision);
     2208    _this = _super.call(this);
     2209    _this.identifiers = ['/'];
     2210    _this.precedence = 200;
     2211    return _this;
     2212  }
     2213  _createClass(FrontCalculatorSymbolOperatorDivision, [{
     2214    key: "operate",
     2215    value: function operate(leftNumber, rightNumber) {
     2216      var result = leftNumber / rightNumber;
     2217
     2218      // // force to 0
     2219      // if (!isFinite(result)) {
     2220      //    return 0;
     2221      // }
     2222      return result;
     2223    }
     2224  }]);
     2225  return FrontCalculatorSymbolOperatorDivision;
     2226}(_frontCalculatorSymbolOperator.default);
     2227
     2228},{"../abstract/front.calculator.symbol.operator.abstract":12}],28:[function(require,module,exports){
     2229"use strict";
     2230
     2231function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     2232Object.defineProperty(exports, "__esModule", {
     2233  value: true
     2234});
     2235exports.default = void 0;
     2236var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract"));
     2237function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     2238function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     2239function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     2240function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     2241function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     2242function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     2243function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     2244function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     2245function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     2246function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     2247function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     2248function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     2249function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     2250/**
     2251 * Operator for mathematical exponentiation.
     2252 * Example: "3^2" => 9, "-3^2" => -9, "3^-2" equals "3^(-2)"
     2253 *
     2254 * @see     https://en.wikipedia.org/wiki/Exponentiation
     2255 * @see     https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow
     2256 *
     2257 */
     2258var FrontCalculatorSymbolOperatorExponentiation = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     2259  _inherits(FrontCalculatorSymbolOperatorExponentiation, _FrontCalculatorSymbo);
     2260  var _super = _createSuper(FrontCalculatorSymbolOperatorExponentiation);
     2261  function FrontCalculatorSymbolOperatorExponentiation() {
     2262    var _this;
     2263    _classCallCheck(this, FrontCalculatorSymbolOperatorExponentiation);
     2264    _this = _super.call(this);
     2265    _this.identifiers = ['^'];
     2266    _this.precedence = 300;
     2267    return _this;
     2268  }
     2269  _createClass(FrontCalculatorSymbolOperatorExponentiation, [{
     2270    key: "operate",
     2271    value: function operate(leftNumber, rightNumber) {
     2272      return Math.pow(leftNumber, rightNumber);
     2273    }
     2274  }]);
     2275  return FrontCalculatorSymbolOperatorExponentiation;
     2276}(_frontCalculatorSymbolOperator.default);
     2277
     2278},{"../abstract/front.calculator.symbol.operator.abstract":12}],29:[function(require,module,exports){
     2279"use strict";
     2280
     2281function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     2282Object.defineProperty(exports, "__esModule", {
     2283  value: true
     2284});
     2285exports.default = void 0;
     2286var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract"));
     2287function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     2288function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     2289function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     2290function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     2291function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     2292function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     2293function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     2294function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     2295function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     2296function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     2297function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     2298function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     2299function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     2300/**
     2301 * Operator for mathematical modulo operation.
     2302 * Example: "5%3" => 2
     2303 *
     2304 * @see https://en.wikipedia.org/wiki/Modulo_operation
     2305 *
     2306 */
     2307var FrontCalculatorSymbolOperatorModulo = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     2308  _inherits(FrontCalculatorSymbolOperatorModulo, _FrontCalculatorSymbo);
     2309  var _super = _createSuper(FrontCalculatorSymbolOperatorModulo);
     2310  function FrontCalculatorSymbolOperatorModulo() {
     2311    var _this;
     2312    _classCallCheck(this, FrontCalculatorSymbolOperatorModulo);
     2313    _this = _super.call(this);
     2314    _this.identifiers = ['%'];
     2315    _this.precedence = 200;
     2316    return _this;
     2317  }
     2318  _createClass(FrontCalculatorSymbolOperatorModulo, [{
     2319    key: "operate",
     2320    value: function operate(leftNumber, rightNumber) {
     2321      return leftNumber % rightNumber;
     2322    }
     2323  }]);
     2324  return FrontCalculatorSymbolOperatorModulo;
     2325}(_frontCalculatorSymbolOperator.default);
     2326
     2327},{"../abstract/front.calculator.symbol.operator.abstract":12}],30:[function(require,module,exports){
     2328"use strict";
     2329
     2330function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     2331Object.defineProperty(exports, "__esModule", {
     2332  value: true
     2333});
     2334exports.default = void 0;
     2335var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract"));
     2336function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     2337function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     2338function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     2339function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     2340function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     2341function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     2342function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     2343function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     2344function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     2345function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     2346function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     2347function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     2348function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     2349/**
     2350 * Operator for mathematical multiplication.
     2351 * Example: "2*3" => 6
     2352 *
     2353 * @see     https://en.wikipedia.org/wiki/Multiplication
     2354 *
     2355 */
     2356var FrontCalculatorSymbolOperatorMultiplication = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     2357  _inherits(FrontCalculatorSymbolOperatorMultiplication, _FrontCalculatorSymbo);
     2358  var _super = _createSuper(FrontCalculatorSymbolOperatorMultiplication);
     2359  function FrontCalculatorSymbolOperatorMultiplication() {
     2360    var _this;
     2361    _classCallCheck(this, FrontCalculatorSymbolOperatorMultiplication);
     2362    _this = _super.call(this);
     2363    _this.identifiers = ['*'];
     2364    _this.precedence = 200;
     2365    return _this;
     2366  }
     2367  _createClass(FrontCalculatorSymbolOperatorMultiplication, [{
     2368    key: "operate",
     2369    value: function operate(leftNumber, rightNumber) {
     2370      return leftNumber * rightNumber;
     2371    }
     2372  }]);
     2373  return FrontCalculatorSymbolOperatorMultiplication;
     2374}(_frontCalculatorSymbolOperator.default);
     2375
     2376},{"../abstract/front.calculator.symbol.operator.abstract":12}],31:[function(require,module,exports){
     2377"use strict";
     2378
     2379function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
     2380Object.defineProperty(exports, "__esModule", {
     2381  value: true
     2382});
     2383exports.default = void 0;
     2384var _frontCalculatorSymbolOperator = _interopRequireDefault(require("../abstract/front.calculator.symbol.operator.abstract"));
     2385function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
     2386function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
     2387function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
     2388function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
     2389function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
     2390function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
     2391function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
     2392function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
     2393function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
     2394function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
     2395function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
     2396function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
     2397function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
     2398/**
     2399 * Operator for mathematical subtraction.
     2400 * Example: "2-1" => 1
     2401 *
     2402 * @see     https://en.wikipedia.org/wiki/Subtraction
     2403 *
     2404 */
     2405var FrontCalculatorSymbolOperatorSubtraction = exports.default = /*#__PURE__*/function (_FrontCalculatorSymbo) {
     2406  _inherits(FrontCalculatorSymbolOperatorSubtraction, _FrontCalculatorSymbo);
     2407  var _super = _createSuper(FrontCalculatorSymbolOperatorSubtraction);
     2408  function FrontCalculatorSymbolOperatorSubtraction() {
     2409    var _this;
     2410    _classCallCheck(this, FrontCalculatorSymbolOperatorSubtraction);
     2411    _this = _super.call(this);
     2412    _this.identifiers = ['-'];
     2413    _this.precedence = 100;
     2414
     2415    /**
     2416     * Notice: The subtraction operator is unary AND binary!
     2417     *
     2418     * @type {boolean}
     2419     */
     2420    _this.operatesUnary = true;
     2421    return _this;
     2422  }
     2423  _createClass(FrontCalculatorSymbolOperatorSubtraction, [{
     2424    key: "operate",
     2425    value: function operate(leftNumber, rightNumber) {
     2426      return leftNumber - rightNumber;
     2427    }
     2428  }]);
     2429  return FrontCalculatorSymbolOperatorSubtraction;
     2430}(_frontCalculatorSymbolOperator.default);
     2431
     2432},{"../abstract/front.calculator.symbol.operator.abstract":12}]},{},[1]);
     2433
     2434/*!
     2435 * https://github.com/alfaslash/array-includes/blob/master/array-includes.js
     2436 *
     2437 * Array includes 1.0.4
     2438 * https://github.com/alfaslash/array-includes
     2439 *
     2440 * Released under the Apache License 2.0
     2441 * https://github.com/alfaslash/array-includes/blob/master/LICENSE
     2442 */
     2443if (![].includes) {
     2444    Array.prototype.includes = function (searchElement, fromIndex) {
     2445        'use strict';
     2446        var O = Object(this);
     2447        var len = parseInt(O.length) || 0;
     2448        if (len === 0) {
     2449            return false;
     2450        }
     2451        var n = parseInt(fromIndex) || 0;
     2452        var k;
     2453        if (n >= 0) {
     2454            k = n;
     2455        } else {
     2456            k = len + n;
     2457            if (k < 0) {
     2458                k = 0;
     2459            }
     2460        }
     2461        while (k < len) {
     2462            var currentElement = O[k];
     2463            if (searchElement === currentElement ||
     2464                (searchElement !== searchElement && currentElement !== currentElement)
     2465            ) {
     2466                return true;
     2467            }
     2468            k++;
     2469        }
     2470        return false;
     2471    };
     2472}
     2473
     2474/**********
     2475 * Common functions
     2476 *
     2477 ***********/
     2478class forminatorFrontUtils {
     2479
     2480    constructor() {}
     2481
     2482    field_is_checkbox($element) {
     2483        var is_checkbox = false;
     2484        $element.each(function () {
     2485            if (jQuery(this).attr('type') === 'checkbox') {
     2486                is_checkbox = true;
     2487                //break
     2488                return false;
     2489            }
     2490        });
     2491
     2492        return is_checkbox;
     2493    }
     2494
     2495    field_is_radio($element) {
     2496        var is_radio = false;
     2497        $element.each(function () {
     2498            if (jQuery(this).attr('type') === 'radio') {
     2499                is_radio = true;
     2500                //break
     2501                return false;
     2502            }
     2503        });
     2504
     2505        return is_radio;
     2506    }
     2507
     2508    field_is_select($element) {
     2509        return $element.is('select');
     2510    }
     2511
     2512    field_has_inputMask( $element ) {
     2513        var hasMask = false;
     2514
     2515        $element.each(function () {
     2516            if ( undefined !== jQuery( this ).attr( 'data-inputmask' ) ) {
     2517                hasMask = true;
     2518                //break
     2519                return false;
     2520            }
     2521        });
     2522
     2523        return hasMask;
     2524    }
     2525
     2526    get_field_value( $element ) {
     2527        var value       = 0;
     2528        var calculation = 0;
     2529        var checked     = null;
     2530
     2531        if (this.field_is_radio($element)) {
     2532            checked = $element.filter(":checked");
     2533            if (checked.length) {
     2534                calculation = checked.data('calculation');
     2535                if (calculation !== undefined) {
     2536                    value = Number(calculation);
     2537                }
     2538            }
     2539        } else if (this.field_is_checkbox($element)) {
     2540            $element.each(function () {
     2541                if (jQuery(this).is(':checked')) {
     2542                    calculation = jQuery(this).data('calculation');
     2543                    if (calculation !== undefined) {
     2544                        value += Number(calculation);
     2545                    }
     2546                }
     2547            });
     2548
     2549        } else if (this.field_is_select($element)) {
     2550            checked = $element.find("option").filter(':selected');
     2551            if (checked.length) {
     2552                calculation = checked.data('calculation');
     2553                if (calculation !== undefined) {
     2554                    value = Number(calculation);
     2555                }
     2556            }
     2557        } else if ( this.field_has_inputMask( $element ) ) {
     2558            value = parseFloat( $element.inputmask('unmaskedvalue').replace(',','.') );
     2559        } else if ( $element.length ) {
     2560            var number = $element.val();
     2561            value = parseFloat( number.replace(',','.') );
     2562        }
     2563
     2564        return isNaN(value) ? 0 : value;
     2565    }
     2566}
     2567
     2568if (window['forminatorUtils'] === undefined) {
     2569    window.forminatorUtils = function () {
     2570        return new forminatorFrontUtils();
     2571    }
     2572}
     2573// the semi-colon before function invocation is a safety net against concatenated
     2574// scripts and/or other plugins which may not be closed properly.
     2575;// noinspection JSUnusedLocalSymbols
     2576(function ($, window, document, undefined) {
     2577
     2578    "use strict";
     2579
     2580    // undefined is used here as the undefined global variable in ECMAScript 3 is
     2581    // mutable (ie. it can be changed by someone else). undefined isn't really being
     2582    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     2583    // can no longer be modified.
     2584
     2585    // window and document are passed through as local variables rather than global
     2586    // as this (slightly) quickens the resolution process and can be more efficiently
     2587    // minified (especially when both are regularly referenced in your plugin).
     2588
     2589    // Create the defaults once
     2590    var pluginName = "forminatorLoader",
     2591        defaults   = {
     2592            action: '',
     2593            type: '',
     2594            id: '',
     2595            render_id: '',
     2596            is_preview: '',
     2597            preview_data: [],
     2598             nonce: false,
     2599            last_submit_data: {},
     2600            extra: {},
     2601        };
     2602
     2603    // The actual plugin constructor
     2604    function ForminatorLoader(element, options) {
     2605        this.element = element;
     2606        this.$el     = $(this.element);
     2607
     2608        // jQuery has an extend method which merges the contents of two or
     2609        // more objects, storing the result in the first object. The first object
     2610        // is generally empty as we don't want to alter the default options for
     2611        // future instances of the plugin
     2612        this.settings  = $.extend({}, defaults, options);
     2613        this._defaults = defaults;
     2614        this._name     = pluginName;
     2615
     2616        this.frontInitCalled = false;
     2617        this.scriptsQue      = [];
     2618        this.frontOptions    = null;
     2619        this.leadFrontOptions    = null;
     2620
     2621        this.init();
     2622    }
     2623
     2624    // Avoid Plugin.prototype conflicts
     2625    $.extend(ForminatorLoader.prototype, {
     2626        init: function () {
     2627            var param = (decodeURI(document.location.search)).replace(/(^\?)/, '').split("&").map(function (n) {
     2628                return n = n.split("="), this[n[0]] = n[1], this
     2629            }.bind({}))[0];
     2630
     2631            param.action           = this.settings.action;
     2632            param.type             = this.settings.type;
     2633            param.id               = this.settings.id;
     2634            param.render_id        = this.settings.render_id;
     2635            param.is_preview       = this.settings.is_preview;
     2636            param.preview_data     = JSON.stringify(this.settings.preview_data);
     2637            param.last_submit_data = this.settings.last_submit_data;
     2638            param.extra            = this.settings.extra;
     2639            param.nonce               = this.settings.nonce;
     2640
     2641            if ( 'undefined' !== typeof this.settings.has_lead ) {
     2642                param.has_lead         = this.settings.has_lead;
     2643                param.leads_id         = this.settings.leads_id;
     2644            }
     2645
     2646            this.load_ajax(param);
     2647            this.handleDiviPopup();
     2648
     2649        },
     2650        load_ajax: function (param) {
     2651            var self = this;
     2652            $.ajax({
     2653                    type: 'POST',
     2654                    url: window.ForminatorFront.ajaxUrl,
     2655                    data: param,
     2656                    cache: false,
     2657                    beforeSend: function () {
     2658                        $(document).trigger('before.load.forminator', param.id);
     2659                    },
     2660                    success: function (data) {
     2661                        if (data.success) {
     2662                            var response = data.data;
     2663
     2664                            $(document).trigger('response.success.load.forminator', param.id, data);
     2665
     2666                            if (!response.is_ajax_load) {
     2667                                //not load ajax
     2668                                return false;
     2669                            }
     2670
     2671                            var pagination_config = [];
     2672
     2673                            if(typeof response.pagination_config === "undefined" && typeof response.options.pagination_config !== "undefined") {
     2674                                pagination_config = response.options.pagination_config;
     2675                            }
     2676
     2677                            // response.pagination_config
     2678                            if (pagination_config) {
     2679                                window.Forminator_Cform_Paginations           = window.Forminator_Cform_Paginations || [];
     2680                                window.Forminator_Cform_Paginations[param.id] = pagination_config;
     2681                            }
     2682
     2683                            self.frontOptions = response.options || null;
     2684
     2685                            // Solution for form Preview
     2686                            if (typeof window.Forminator_Cform_Paginations === "undefined" && self.frontOptions.pagination_config) {
     2687                                window.Forminator_Cform_Paginations           = window.Forminator_Cform_Paginations || [];
     2688                                window.Forminator_Cform_Paginations[param.id] = self.frontOptions.pagination_config;
     2689                            }
     2690
     2691                            if( 'undefined' !== typeof response.lead_options ) {
     2692
     2693                                self.leadFrontOptions = response.lead_options || null;
     2694
     2695                                if (typeof window.Forminator_Cform_Paginations === "undefined" && self.leadFrontOptions.pagination_config) {
     2696                                    window.Forminator_Cform_Paginations           = window.Forminator_Cform_Paginations || [];
     2697                                    window.Forminator_Cform_Paginations[param.leads_id] = self.leadFrontOptions.pagination_config;
     2698                                }
     2699
     2700                            }
     2701
     2702                            //response.html
     2703                            if (response.html) {
     2704                                var style  = response.style || null;
     2705                                var script = response.script || null;
     2706                                self.render_html(response.html, style, script);
     2707                            }
     2708
     2709                            //response.styles
     2710                            if (response.styles) {
     2711                                self.maybe_append_styles(response.styles);
     2712                            }
     2713
     2714                            if (response.scripts) {
     2715                                self.maybe_append_scripts(response.scripts);
     2716                            }
     2717
     2718                            if (!response.scripts && self.frontOptions) {
     2719                                // when no additional scripts, direct execute
     2720                                self.init_front();
     2721                            }
     2722
     2723
     2724                        } else {
     2725                            $(document).trigger('response.error.load.forminator', param.id, data);
     2726                        }
     2727
     2728                    },
     2729                    error: function () {
     2730                        $(document).trigger('request.error.load.forminator', param.id);
     2731                    },
     2732                }
     2733            ).always(function () {
     2734                $(document).trigger('after.load.forminator', param.id);
     2735            });
     2736        },
     2737
     2738        render_html: function (html, style, script) {
     2739            var id              = this.settings.id,
     2740                render_id       = this.settings.render_id,
     2741                // save message
     2742                message         = '',
     2743                wrapper_message = null;
     2744
     2745            wrapper_message = this.$el.find('.forminator-response-message');
     2746            if (wrapper_message.length) {
     2747                message = wrapper_message.get(0).outerHTML;
     2748            }
     2749            wrapper_message = this.$el.find('.forminator-poll-response-message');
     2750            if (wrapper_message.length) {
     2751                message = wrapper_message.get(0).outerHTML;
     2752            }
     2753
     2754            if ( this.$el.parent().hasClass( 'forminator-guttenberg' ) ) {
     2755                this.$el.parent()
     2756                    .html(html);
     2757            } else {
     2758                this.$el
     2759                .replaceWith(html);
     2760            }
     2761
     2762            if (message) {
     2763                $('#forminator-module-' + id + '[data-forminator-render=' + render_id + '] .forminator-response-message')
     2764                    .replaceWith(message);
     2765                $('#forminator-module-' + id + '[data-forminator-render=' + render_id + '] .forminator-poll-response-message')
     2766                    .replaceWith(message);
     2767            }
     2768
     2769            //response.style
     2770            if (style) {
     2771                if ($('style#forminator-module-' + id).length) {
     2772                    $('style#forminator-module-' + id).remove();
     2773                }
     2774                $('body').append(style);
     2775            }
     2776
     2777            if (script) {
     2778                $('body').append(script);
     2779
     2780            }
     2781        },
     2782
     2783        maybe_append_styles: function (styles) {
     2784            for (var style_id in styles) {
     2785                if (styles.hasOwnProperty(style_id)) {
     2786                    // already loaded?
     2787                    if (!$('link#' + style_id).length) {
     2788                        var link = $('<link>');
     2789                        link.attr('rel', 'stylesheet');
     2790                        link.attr('id', style_id);
     2791                        link.attr('type', 'text/css');
     2792                        link.attr('media', 'all');
     2793                        link.attr('href', styles[style_id].src);
     2794                        $('head').append(link);
     2795                    }
     2796                }
     2797            }
     2798        },
     2799
     2800        maybe_append_scripts: function (scripts) {
     2801            var self           = this,
     2802                scripts_to_load = [],
     2803                hasHustle       = $( 'body' ).find( '.hustle-ui' ).length,
     2804            paypal_src      = $( 'body' ).find( "script[src^='https://www.paypal.com/sdk/js']" ).attr('src')
     2805            ;
     2806
     2807            for (var script_id in scripts) {
     2808                if (scripts.hasOwnProperty(script_id)) {
     2809                    var load_on = scripts[script_id].on;
     2810                    var load_of = scripts[script_id].load;
     2811                    // already loaded?
     2812                    if ('window' === load_on) {
     2813                        if ( window[load_of] && 'forminator-google-recaptcha' !== script_id && 0 === hasHustle ) {
     2814                            continue;
     2815                        }
     2816                    } else if ('$' === load_on) {
     2817                        if ($.fn[load_of]) {
     2818                            continue;
     2819                        }
     2820                    }
     2821
     2822                    var script = {};
     2823                    script.src = scripts[script_id].src;
     2824                    // Check if a paypal script is already loaded.
     2825                    if ( script.src !== paypal_src ) {
     2826                        scripts_to_load.push(script);
     2827                        this.scriptsQue.push(script_id);
     2828                    }
     2829                }
     2830            }
     2831
     2832
     2833            if (!this.scriptsQue.length) {
     2834                this.init_front();
     2835                return;
     2836            }
     2837
     2838            for (var script_id_to_load in scripts_to_load) {
     2839                if (scripts_to_load.hasOwnProperty(script_id_to_load)) {
     2840                    this.load_script(scripts_to_load[script_id_to_load]);
     2841                }
     2842            }
     2843
     2844        },
     2845
     2846        load_script: function (script_props) {
     2847            var self   = this;
     2848            var script = document.createElement('script');
     2849            var body   = document.getElementsByTagName('body')[0];
     2850
     2851            script.type   = 'text/javascript';
     2852            script.src    = script_props.src;
     2853            script.async  = true;
     2854            script.defer  = true;
     2855            script.onload = function () {
     2856                self.script_on_load();
     2857            };
     2858
     2859            // Check if script is already loaded or not.
     2860            if ( 0 === $( 'script[src="' + script.src + '"]' ).length ) {
     2861                body.appendChild(script);
     2862            } else {
     2863                self.script_on_load();
     2864            }
     2865        },
     2866
     2867        script_on_load: function () {
     2868            this.scriptsQue.pop();
     2869
     2870            if (!this.scriptsQue.length) {
     2871                this.init_front();
     2872            }
     2873        },
     2874
     2875        init_front: function () {
     2876            if (this.frontInitCalled) {
     2877                return;
     2878            }
     2879
     2880            this.frontInitCalled = true;
     2881            var id               = this.settings.id;
     2882            var render_id        = this.settings.render_id;
     2883            var options          = this.frontOptions || null;
     2884            var lead_options     = this.leadFrontOptions || null;
     2885
     2886            if (options) {
     2887                $('#forminator-module-' + id + '[data-forminator-render="' + render_id + '"]')
     2888                    .forminatorFront(options);
     2889            }
     2890            if ( 'undefined' !== typeof this.settings.has_lead && lead_options) {
     2891                var leads_id = this.settings.leads_id;
     2892                $('#forminator-module-' + leads_id + '[data-forminator-render="' + render_id + '"]')
     2893                    .forminatorFront(lead_options);
     2894            }
     2895
     2896            this.init_window_vars();
     2897
     2898        },
     2899
     2900        init_window_vars: function () {
     2901            // RELOAD type
     2902            if (typeof ForminatorValidationErrors !== 'undefined') {
     2903                var forminatorFrontSubmit = jQuery(ForminatorValidationErrors.selector).data('forminatorFrontSubmit');
     2904                if (typeof forminatorFrontSubmit !== 'undefined') {
     2905                    forminatorFrontSubmit.show_messages(ForminatorValidationErrors.errors);
     2906                }
     2907            }
     2908
     2909            if (typeof ForminatorFormHider !== 'undefined') {
     2910                var forminatorFront = jQuery(ForminatorFormHider.selector).data('forminatorFront');
     2911                if (typeof forminatorFront !== 'undefined') {
     2912                    forminatorFront.hide();
     2913                }
     2914            }
     2915        },
     2916
     2917        handleDiviPopup: function () {
     2918            var self = this;
     2919
     2920            if ( 'undefined' !== typeof DiviArea ) {
     2921                DiviArea.addAction( 'show_area', function( area ) {
     2922                    var $form = area.find( '#' + self.element.id );
     2923
     2924                    if ( 0 !== $form.length ) {
     2925                        self.frontInitCalled = false;
     2926                        self.init_front();
     2927                        forminator_render_hcaptcha();
     2928                    }
     2929                });
     2930            }
     2931        },
     2932    });
     2933
     2934    // A really lightweight plugin wrapper around the constructor,
     2935    // preventing against multiple instantiations
     2936    $.fn[pluginName] = function (options) {
     2937        return this.each(function () {
     2938            if (!$.data(this, pluginName)) {
     2939                $.data(this, pluginName, new ForminatorLoader(this, options));
     2940            }
     2941        });
     2942    };
     2943
     2944
     2945})(jQuery, window, document);
     2946
     2947// the semi-colon before function invocation is a safety net against concatenated
     2948// scripts and/or other plugins which may not be closed properly.
     2949;// noinspection JSUnusedLocalSymbols
     2950(function ($, window, document, undefined) {
     2951
     2952    "use strict";
     2953
     2954    // undefined is used here as the undefined global variable in ECMAScript 3 is
     2955    // mutable (ie. it can be changed by someone else). undefined isn't really being
     2956    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     2957    // can no longer be modified.
     2958
     2959    // window and document are passed through as local variables rather than global
     2960    // as this (slightly) quickens the resolution process and can be more efficiently
     2961    // minified (especially when both are regularly referenced in your plugin).
     2962
     2963    // Create the defaults once
     2964    var pluginName = "forminatorFront",
     2965        defaults   = {
     2966            form_type: 'custom-form',
     2967            rules: {},
     2968            messages: {},
     2969            conditions: {},
     2970            inline_validation: false,
     2971            print_value: false,
     2972            chart_design: 'bar',
     2973            chart_options: {},
     2974            forminator_fields: [],
     2975            general_messages: {
     2976                calculation_error: 'Failed to calculate field.',
     2977                payment_require_ssl_error: 'SSL required to submit this form, please check your URL.',
     2978                payment_require_amount_error: 'PayPal amount must be greater than 0.',
     2979                form_has_error: 'Please correct the errors before submission.'
     2980            },
     2981            payment_require_ssl : false,
     2982        };
     2983
     2984    // The actual plugin constructor
     2985    function ForminatorFront(element, options) {
     2986        this.element                    = element;
     2987        this.$el                        = $(this.element);
     2988        this.forminator_selector        = '#' + $(this.element).attr('id') + '[data-forminator-render="' + $(this.element).data('forminator-render') + '"]';
     2989        this.forminator_loader_selector = 'div[data-forminator-render="' + $(this.element).data('forminator-render') + '"]' + '[data-form="' + $(this.element).attr('id') + '"]';
     2990
     2991        // jQuery has an extend method which merges the contents of two or
     2992        // more objects, storing the result in the first object. The first object
     2993        // is generally empty as we don't want to alter the default options for
     2994        // future instances of the plugin
     2995        this.settings = $.extend({}, defaults, options);
     2996
     2997        // special treatment for rules, messages, and conditions
     2998        if (typeof this.settings.messages !== 'undefined') {
     2999            this.settings.messages = this.maybeParseStringToJson(this.settings.messages, 'object');
     3000        }
     3001        if (typeof this.settings.rules !== 'undefined') {
     3002            this.settings.rules = this.maybeParseStringToJson(this.settings.rules, 'object');
     3003        }
     3004        if (typeof this.settings.calendar !== 'undefined') {
     3005            this.settings.calendar = this.maybeParseStringToJson(this.settings.calendar, 'array');
     3006        }
     3007
     3008        this._defaults = defaults;
     3009        this._name     = pluginName;
     3010        this.form_id   = 0;
     3011        this.template_type = '';
     3012
     3013        this.init();
     3014        this.handleDiviPopup();
     3015    }
     3016
     3017    // Avoid Plugin.prototype conflicts
     3018    $.extend(ForminatorFront.prototype, {
     3019        init: function () {
     3020            var self = this;
     3021
     3022            if (this.$el.find('input[name="form_id"]').length > 0) {
     3023                this.form_id = this.$el.find('input[name="form_id"]').val();
     3024            }
     3025            if (this.$el.find('input[name="form_type"]').length > 0) {
     3026                this.template_type = this.$el.find('input[name="form_type"]').val();
     3027            }
     3028
     3029            $(this.forminator_loader_selector).remove();
     3030
     3031            // If form from hustle popup, do not show
     3032            if (this.$el.closest('.wph-modal').length === 0) {
     3033                this.$el.show();
     3034            }
     3035
     3036            // Show form when popup trigger with click
     3037            $(document).on("hustle:module:displayed", function (e, data) {
     3038                var $modal = $('.wph-modal-active');
     3039                $modal.find('form').css('display', '');
     3040            });
     3041
     3042            self.reint_intlTelInput();
     3043
     3044            // Show form when popup trigger
     3045            setTimeout(function () {
     3046                var $modal = $('.wph-modal-active');
     3047                $modal.find('form').css('display', '');
     3048            }, 10);
     3049
     3050            //selective activation based on type of form
     3051            switch (this.settings.form_type) {
     3052                case  'custom-form':
     3053                    $( this.element ).each( function() {
     3054                        self.init_custom_form( this );
     3055                    });
     3056
     3057                    this.$el.on( 'forminator-clone-group', function ( event ) {
     3058                        self.init_custom_form( event.target );
     3059                    } );
     3060
     3061                    break;
     3062                case  'poll':
     3063                    this.init_poll_form();
     3064                    break;
     3065                case  'quiz':
     3066                    this.init_quiz_form();
     3067                    break;
     3068
     3069            }
     3070
     3071            //init submit
     3072            var submitOptions = {
     3073                form_type: self.settings.form_type,
     3074                forminator_selector: self.forminator_selector,
     3075                chart_design: self.settings.chart_design,
     3076                chart_options: self.settings.chart_options,
     3077                has_quiz_loader: self.settings.has_quiz_loader,
     3078                has_loader: self.settings.has_loader,
     3079                loader_label: self.settings.loader_label,
     3080                resetEnabled: self.settings.is_reset_enabled,
     3081                inline_validation: self.settings.inline_validation,
     3082            };
     3083
     3084            if( 'leads' === this.template_type || 'quiz' === this.settings.form_type ) {
     3085                submitOptions.form_placement = self.settings.form_placement;
     3086                submitOptions.hasLeads = self.settings.hasLeads;
     3087                submitOptions.leads_id = self.settings.leads_id;
     3088                submitOptions.quiz_id = self.settings.quiz_id;
     3089                submitOptions.skip_form = self.settings.skip_form;
     3090            }
     3091
     3092            $(this.element).forminatorFrontSubmit( submitOptions );
     3093
     3094
     3095            // TODO: confirm usage on form type
     3096            // Handle field activation classes
     3097            this.activate_field();
     3098            // Handle special classes for material design
     3099            // this.material_field();
     3100
     3101            // Init small form for all type of form
     3102            this.small_form();
     3103        },
     3104        init_custom_form: function ( form_selector ) {
     3105
     3106            var self            = this,
     3107                $saveDraft      = this.$el.find( '.forminator-save-draft-link' ),
     3108                saveDraftExists = 0 !== $saveDraft.length ? true : false,
     3109                draftTimer
     3110                ;
     3111
     3112            //initiate validator
     3113            this.init_intlTelInput_validation( form_selector );
     3114
     3115            if (this.settings.inline_validation) {
     3116
     3117                $( form_selector ).forminatorFrontValidate({
     3118                    rules: self.settings.rules,
     3119                    messages: self.settings.messages
     3120                });
     3121            }
     3122
     3123            // initiate calculator
     3124            $( form_selector ).forminatorFrontCalculate({
     3125                forminatorFields: self.settings.forminator_fields,
     3126                generalMessages: self.settings.general_messages,
     3127                memoizeTime: self.settings.calcs_memoize_time || 300,
     3128            });
     3129
     3130            // initiate merge tags
     3131            $( form_selector ).forminatorFrontMergeTags({
     3132                forminatorFields: self.settings.forminator_fields,
     3133                print_value: self.settings.print_value,
     3134            });
     3135
     3136            //initiate pagination
     3137            this.init_pagination( form_selector );
     3138
     3139            // initiate payment if exist
     3140            var first_payment = $( form_selector ).find('div[data-is-payment="true"], input[data-is-payment="true"]').first();
     3141
     3142            if( self.settings.has_stripe ) {
     3143                var stripe_payment = $(this.element).find('.forminator-stripe-element').first();
     3144
     3145                if ( $( self.element ).is( ':visible' ) ) {
     3146                    this.renderStripe( self, stripe_payment );
     3147                }
     3148
     3149                // Show Stripe on modal display.
     3150                $( document ).on( "hustle:module:displayed", function () {
     3151                    self.renderStripe( self, stripe_payment );
     3152                });
     3153            }
     3154
     3155            if( self.settings.has_paypal
     3156                    // Fix for Divi popup.
     3157                    && ( ! $( self.element ).closest( '.et_pb_section' ).length
     3158                    || $( self.element ).is( ':visible' ) ) ) {
     3159                $(this.element).forminatorFrontPayPal({
     3160                    type: 'paypal',
     3161                    paymentEl: this.settings.paypal_config,
     3162                    paymentRequireSsl: self.settings.payment_require_ssl,
     3163                    generalMessages: self.settings.general_messages,
     3164                    has_loader: self.settings.has_loader,
     3165                    loader_label: self.settings.loader_label,
     3166                });
     3167            }
     3168
     3169            //initiate condition
     3170            $( form_selector ).forminatorFrontCondition(this.settings.conditions, this.settings.calendar);
     3171
     3172            //initiate forminator ui scripts
     3173            this.init_fui( form_selector );
     3174
     3175            //initiate datepicker
     3176            $( form_selector ).find('.forminator-datepicker').forminatorFrontDatePicker(this.settings.calendar);
     3177
     3178            // Handle responsive captcha
     3179            this.responsive_captcha( form_selector );
     3180
     3181            // Handle field counter
     3182            this.field_counter( form_selector );
     3183
     3184            // Handle number input
     3185            this.field_number( form_selector );
     3186
     3187            // Handle time fields
     3188            this.field_time();
     3189
     3190            // Handle upload field change
     3191            $( form_selector ).find('.forminator-multi-upload').forminatorFrontMultiFile( this.$el );
     3192
     3193            this.upload_field( form_selector );
     3194
     3195            this.init_login_2FA();
     3196
     3197            self.maybeRemoveDuplicateFields( form_selector );
     3198
     3199            self.checkComplianzBlocker();
     3200
     3201            // Handle function on resize
     3202            $(window).on('resize', function () {
     3203                self.responsive_captcha( form_selector );
     3204            });
     3205
     3206            // Handle function on load
     3207            $( window ).on( 'load', function () {
     3208                // Repeat the function here, just in case our scripts gets loaded late
     3209                self.maybeRemoveDuplicateFields( form_selector );
     3210            });
     3211
     3212            // We have to declare initialData here, after everything has been set initially, to prevent triggering change event.
     3213            var initialData = saveDraftExists ? this.$el.serializeArray() : '';
     3214            this.$el.find( ".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea, .forminator-field-signature").on( 'change input', function (e) {
     3215                if ( saveDraftExists && $saveDraft.hasClass( 'disabled' ) ) {
     3216                    clearTimeout( draftTimer );
     3217                    draftTimer = setTimeout( function() {
     3218                            self.maybe_enable_save_draft( $saveDraft, initialData );
     3219                        },
     3220                        500
     3221                    );
     3222                }
     3223            });
     3224
     3225            if( 'undefined' !== typeof self.settings.hasLeads ) {
     3226                if( 'beginning' === self.settings.form_placement ) {
     3227                    $('#forminator-module-' + this.settings.quiz_id ).css({
     3228                        'height': 0,
     3229                        'opacity': 0,
     3230                        'overflow': 'hidden',
     3231                        'visibility': 'hidden',
     3232                        'pointer-events': 'none',
     3233                        'margin': 0,
     3234                        'padding': 0,
     3235                        'border': 0
     3236                    });
     3237                }
     3238                if( 'end' === self.settings.form_placement ) {
     3239                    $( form_selector ).css({
     3240                        'height': 0,
     3241                        'opacity': 0,
     3242                        'overflow': 'hidden',
     3243                        'visibility': 'hidden',
     3244                        'pointer-events': 'none',
     3245                        'margin': 0,
     3246                        'padding': 0,
     3247                        'border': 0
     3248                    });
     3249                }
     3250            }
     3251
     3252        },
     3253        init_poll_form: function() {
     3254
     3255            var self       = this,
     3256                $fieldset  = this.$el.find( 'fieldset' ),
     3257                $selection = this.$el.find( '.forminator-radio input' ),
     3258                $input     = this.$el.find( '.forminator-input' ),
     3259                $field     = $input.closest( '.forminator-field' )
     3260                ;
     3261
     3262            // Load input states
     3263            FUI.inputStates( $input );
     3264
     3265            // Show input when option has been selected
     3266            $selection.on( 'click', function() {
     3267
     3268                // Reset
     3269                $field.addClass( 'forminator-hidden' );
     3270                $field.attr( 'aria-hidden', 'true' );
     3271                $input.removeAttr( 'tabindex' );
     3272                $input.attr( 'name', '' );
     3273
     3274                var checked = this.checked,
     3275                    $id     = $( this ).attr( 'id' ),
     3276                    $name   = $( this ).attr( 'name' )
     3277                    ;
     3278
     3279                // Once an option has been chosen, remove error class.
     3280                $fieldset.removeClass( 'forminator-has_error' );
     3281
     3282                if ( self.$el.find( '.forminator-input#' + $id + '-extra' ).length ) {
     3283
     3284                    var $extra = self.$el.find( '.forminator-input#' + $id + '-extra' ),
     3285                        $extraField = $extra.closest( '.forminator-field' )
     3286                        ;
     3287
     3288                    if ( checked ) {
     3289
     3290                        $extra.attr( 'name', $name + '-extra' );
     3291
     3292                        $extraField.removeClass( 'forminator-hidden' );
     3293                        $extraField.removeAttr( 'aria-hidden' );
     3294
     3295                        $extra.attr( 'tabindex', '-1' );
     3296                        $extra.focus();
     3297
     3298                    } else {
     3299
     3300                        $extraField.addClass( 'forminator-hidden' );
     3301                        $extraField.attr( 'aria-hidden', 'true' );
     3302
     3303                        $extra.removeAttr( 'tabindex' );
     3304
     3305                    }
     3306                }
     3307
     3308                return true;
     3309
     3310            });
     3311
     3312            // Disable options
     3313            if ( this.$el.hasClass( 'forminator-poll-disabled' ) ) {
     3314
     3315                this.$el.find( '.forminator-radio' ).each( function() {
     3316
     3317                    $( this ).addClass( 'forminator-disabled' );
     3318                    $( this ).find( 'input' ).attr( 'disabled', true );
     3319
     3320                });
     3321            }
     3322        },
     3323
     3324        init_quiz_form: function () {
     3325            var self = this,
     3326                lead_placement = 'undefined' !== typeof self.settings.form_placement ? self.settings.form_placement : '',
     3327                quiz_id = 'undefined' !== typeof self.settings.quiz_id ? self.settings.quiz_id : 0;
     3328
     3329            this.$el.find('.forminator-button:not(.forminator-quiz-start)').each(function () {
     3330                $(this).prop("disabled", true);
     3331            });
     3332
     3333            this.$el.find('.forminator-answer input').each(function () {
     3334                $(this).attr('checked', false);
     3335            });
     3336
     3337            this.$el.find('.forminator-result--info button').on('click', function () {
     3338                location.reload();
     3339            });
     3340
     3341            $('#forminator-quiz-leads-' + quiz_id + ' .forminator-quiz-intro .forminator-quiz-start').on('click', function(e){
     3342                e.preventDefault();
     3343                $(this).closest( '.forminator-quiz-intro').hide();
     3344                self.$el.prepend('<button class="forminator-button forminator-quiz-start forminator-hidden"></button>')
     3345                        .find('.forminator-quiz-start').trigger('click').remove();
     3346            });
     3347
     3348            this.$el.on('click', '.forminator-quiz-start', function (e) {
     3349                e.preventDefault();
     3350                self.$el.find('.forminator-quiz-intro').hide();
     3351                self.$el.find('.forminator-pagination').removeClass('forminator-hidden');
     3352                //initiate pagination
     3353                var args = {
     3354                    totalSteps: self.$el.find('.forminator-pagination').length - 1, //subtract the last step with result
     3355                    step: 0,
     3356                    quiz: true
     3357                };
     3358                if ( self.settings.text_next ) {
     3359                    args.next_button = self.settings.text_next;
     3360                }
     3361                if ( self.settings.text_prev ) {
     3362                    args.prev_button = self.settings.text_prev;
     3363                }
     3364                if ( self.settings.submit_class ) {
     3365                    args.submitButtonClass = self.settings.submit_class;
     3366                }
     3367
     3368                $(self.element).forminatorFrontPagination(args);
     3369            });
     3370
     3371            if( 'end' !== lead_placement ) {
     3372                this.$el.find('.forminator-submit-rightaway').on("click", function () {
     3373                    self.$el.submit();
     3374                    $(this).closest('.forminator-question').find('.forminator-submit-rightaway').addClass('forminator-has-been-disabled').attr('disabled', 'disabled');
     3375                });
     3376            }
     3377
     3378            if( self.settings.hasLeads ) {
     3379                if( 'beginning' === lead_placement ) {
     3380                    self.$el.css({
     3381                        'height': 0,
     3382                        'opacity': 0,
     3383                        'overflow': 'hidden',
     3384                        'visibility': 'hidden',
     3385                        'pointer-events': 'none',
     3386                        'margin': 0,
     3387                        'padding': 0,
     3388                        'border': 0
     3389                    });
     3390                }
     3391                if( 'end' === lead_placement ) {
     3392                    self.$el.closest('div').find('#forminator-module-' + self.settings.leads_id ).css({
     3393                        'height': 0,
     3394                        'opacity': 0,
     3395                        'overflow': 'hidden',
     3396                        'visibility': 'hidden',
     3397                        'pointer-events': 'none',
     3398                        'margin': 0,
     3399                        'padding': 0,
     3400                        'border': 0
     3401                    });
     3402                    $('#forminator-quiz-leads-' + quiz_id + ' .forminator-lead-form-skip' ).hide();
     3403                }
     3404            }
     3405
     3406            this.$el.on('click', '.forminator-social--icon a', function (e) {
     3407                e.preventDefault();
     3408                var social        = $(this).data('social'),
     3409                    url           = $(this).closest('.forminator-social--icons').data('url'),
     3410                    message       = $(this).closest('.forminator-social--icons').data('message'),
     3411                    message       = encodeURIComponent(message),
     3412                     social_shares = {
     3413                        'facebook': 'https://www.facebook.com/sharer/sharer.php?u=' + url + '&quote=' + message,
     3414                        'twitter': 'https://twitter.com/intent/tweet?&url=' + url + '&text=' + message,
     3415                        'google': 'https://plus.google.com/share?url=' + url,
     3416                        'linkedin': 'https://www.linkedin.com/shareArticle?mini=true&url=' + url + '&title=' + message
     3417                    };
     3418
     3419                if (social_shares[social] !== undefined) {
     3420                    var newwindow = window.open(social_shares[social], social, 'height=' + $(window).height() + ',width=' + $(window).width());
     3421                    if (window.focus) {
     3422                        newwindow.focus();
     3423                    }
     3424                    return false;
     3425                }
     3426            });
     3427
     3428            this.$el.on('change', '.forminator-answer input', function (e) {
     3429                var paginated      = !!$( this ).closest('.forminator-pagination').length,
     3430                    parent         = paginated ? $( this ).closest('.forminator-pagination') : self.$el,
     3431                    count          = parent.find('.forminator-answer input:checked').length,
     3432                    amount_answers = parent.find('.forminator-question').length,
     3433                    parentQuestion = $( this ).closest( '.forminator-question' ),
     3434                    isMultiChoice  = parentQuestion.data( 'multichoice' )
     3435                    ;
     3436
     3437                self.$el.find('.forminator-button:not(.forminator-button-back)').each(function () {
     3438                    var disabled = count < amount_answers;
     3439                    $( this ).prop('disabled', disabled);
     3440                    if ( paginated ) {
     3441                        if ( disabled ) {
     3442                            $( this ).addClass('forminator-disabled');
     3443                        } else {
     3444                            $( this ).removeClass('forminator-disabled');
     3445                        }
     3446                    }
     3447                });
     3448
     3449                // If multichoice is false, uncheck other options
     3450                if( this.checked && false === isMultiChoice ) {
     3451                    parentQuestion
     3452                    .find( '.forminator-answer' )
     3453                    .not( $( this ).parent( '.forminator-answer' ) )
     3454                    .each( function( i, el ){
     3455                        $( el ).find( '> input' ).prop( 'checked', false );
     3456                    });
     3457                }
     3458
     3459            });
     3460        },
     3461
     3462        small_form: function () {
     3463
     3464            var form      = $( this.element ),
     3465                formWidth = form.width()
     3466                ;
     3467
     3468            if ( 783 < Math.max( document.documentElement.clientWidth, window.innerWidth || 0 ) ) {
     3469
     3470                if ( form.hasClass( 'forminator-size--small' ) ) {
     3471
     3472                    if ( 480 < formWidth ) {
     3473                        form.removeClass( 'forminator-size--small' );
     3474                    }
     3475                } else {
     3476                    var hasHustle = form.closest('.hustle-content');
     3477
     3478                    if ( form.is(":visible") && 480 >= formWidth && ! hasHustle.length ) {
     3479                        form.addClass( 'forminator-size--small' );
     3480                    }
     3481                }
     3482            }
     3483        },
     3484
     3485        init_intlTelInput_validation: function ( form_selector ) {
     3486
     3487            var form        = $( form_selector ),
     3488                is_material = form.is('.forminator-design--material'),
     3489                fields      = form.find('.forminator-field--phone');
     3490
     3491            fields.each(function () {
     3492
     3493                // Initialize intlTelInput plugin on each field with "format check" enabled and
     3494                // set to check either "international" or "standard" phones.
     3495                var self              = this,
     3496                    is_national_phone = $(this).data('national_mode'),
     3497                    country           = $(this).data('country'),
     3498                    validation        = $(this).data('validation');
     3499
     3500                if ('undefined' !== typeof (is_national_phone)) {
     3501
     3502                    if (is_material) {
     3503                        //$(this).unwrap('.forminator-input--wrap');
     3504                    }
     3505
     3506                    var args = {
     3507                        nationalMode: ('enabled' === is_national_phone) ? true : false,
     3508                        initialCountry: 'undefined' !== typeof ( country ) ? country : 'us',
     3509                        utilsScript: window.ForminatorFront.cform.intlTelInput_utils_script,
     3510                    };
     3511
     3512                    if ( 'undefined' !== typeof ( validation ) && 'standard' === validation ) {
     3513                        args.allowDropdown  = false;
     3514                    }
     3515                    // stop from removing country code.
     3516                    if ( 'undefined' !== typeof ( validation ) && 'international' === validation ) {
     3517                        args.autoHideDialCode = false;
     3518                    }
     3519
     3520                    var iti = $(this).intlTelInput(args);
     3521                    if ( 'undefined' !== typeof ( validation )
     3522                        && 'international' === validation ) {
     3523                        var dial_code = $(this).intlTelInput( 'getSelectedCountryData' ).dialCode,
     3524                            country_code = '+' + dial_code;
     3525                        if ( country_code !== $(this).val() ) {
     3526                            var phone_value = $(this).val().trim().replace( dial_code, '' ).replace( '+', '' );
     3527                                $(this).val( country_code + phone_value );
     3528                        }
     3529                    }
     3530
     3531                    if ( 'undefined' !== typeof ( validation ) && 'standard' === validation ) {
     3532                        // Reset country to default if changed and invalid previously.
     3533                        $( this ).on( 'blur', function() {
     3534                            if ( '' === $( self ).val() ) {
     3535                                iti.intlTelInput( 'setCountry', country );
     3536                                form.validate().element( $( self ) );
     3537                            }
     3538                        });
     3539                    }
     3540
     3541                    // Use libphonenumber to format the telephone number.
     3542                    $(this).on('input', function() {
     3543                        var countryData = $( self ).intlTelInput( 'getSelectedCountryData' );
     3544                        var regionCode = (countryData && countryData.iso2) ? countryData.iso2.toUpperCase() : '';
     3545
     3546                        // return if no region code is present
     3547                        if('' === regionCode) {
     3548                            return
     3549                        }
     3550
     3551                        var phoneNumber = $(this).val();
     3552                        var isValidLength = libphonenumber.validatePhoneNumberLength(phoneNumber, regionCode) !== 'TOO_LONG';
     3553
     3554                        if(!isValidLength) {
     3555                            // Prevent further typing when the number exceeds the maximum length
     3556                            $(this).val(phoneNumber.slice(0, phoneNumber.length - 1));
     3557                        } else {
     3558                            var formatter = new libphonenumber.AsYouType(regionCode);
     3559                            var formattedNumber = formatter.input(phoneNumber);
     3560                            $(this).val(formattedNumber);
     3561                        }
     3562                    });
     3563
     3564                    if ( ! is_material ) {
     3565                        $(this).closest( '.forminator-field' ).find( 'div.iti' ).addClass( 'forminator-phone' );
     3566                    } else {
     3567                        $(this).closest( '.forminator-field' ).find( 'div.iti' ).addClass( 'forminator-input-with-phone' );
     3568
     3569                        if ( $(this).closest( '.forminator-field' ).find( 'div.iti' ).hasClass( 'iti--allow-dropdown' ) ) {
     3570                            $(this).closest( '.forminator-field' ).find( '.forminator-label' ).addClass( 'iti--allow-dropdown' );
     3571                        }
     3572                    }
     3573
     3574                    // intlTelInput plugin adds a markup that's not compatible with 'material' theme when 'allowDropdown' is true (default).
     3575                    // If we're going to allow users to disable the dropdown, this should be adjusted accordingly.
     3576                    if (is_material) {
     3577                        //$(this).closest('.intl-tel-input.allow-dropdown').addClass('forminator-phone-intl').removeClass('intl-tel-input');
     3578                        //$(this).wrap('<div class="forminator-input--wrap"></div>');
     3579                    }
     3580                }
     3581            });
     3582
     3583        },
     3584
     3585        reint_intlTelInput: function () {
     3586
     3587            var self = this;
     3588            self.$el.on( 'after:forminator:form:submit', function (e, data) {
     3589                self.init_intlTelInput_validation( self.forminator_selector );
     3590            } );
     3591        },
     3592
     3593        init_fui: function ( form_selector ) {
     3594
     3595            var form        = $( form_selector ),
     3596                input       = form.find( '.forminator-input' ),
     3597                textarea    = form.find( '.forminator-textarea' ),
     3598                select2     = form.find( '.forminator-select2' ),
     3599                multiselect = form.find( '.forminator-multiselect' ),
     3600                stripe      = form.find( '.forminator-stripe-element' ),
     3601                slider      = form.find( '.forminator-slider' )
     3602                ;
     3603
     3604            var isDefault  = ( form.attr( 'data-design' ) === 'default' ),
     3605                isBold     = ( form.attr( 'data-design' ) === 'bold' ),
     3606                isFlat     = ( form.attr( 'data-design' ) === 'flat' ),
     3607                isMaterial = ( form.attr( 'data-design' ) === 'material' )
     3608                ;
     3609
     3610            if ( input.length ) {
     3611                input.each( function() {
     3612                    FUI.inputStates( this );
     3613                });
     3614            }
     3615
     3616            if ( textarea.length ) {
     3617                textarea.each( function() {
     3618                    FUI.textareaStates( this );
     3619                });
     3620            }
     3621
     3622            if ( 'function' === typeof FUI.select2 ) {
     3623                FUI.select2( select2.length );
     3624            }
     3625
     3626            if ( 'function' === typeof FUI.slider ) {
     3627                FUI.slider();
     3628            }
     3629
     3630            if ( multiselect.length ) {
     3631                FUI.multiSelectStates( multiselect );
     3632            }
     3633
     3634            if ( form.hasClass( 'forminator-design--material' ) ) {
     3635                if ( input.length ) {
     3636                    input.each( function() {
     3637                        FUI.inputMaterial( this );
     3638                    });
     3639                }
     3640
     3641                if ( textarea.length ) {
     3642                    textarea.each( function() {
     3643                        FUI.textareaMaterial( this );
     3644                    });
     3645                }
     3646
     3647                if ( stripe.length ) {
     3648                    stripe.each( function() {
     3649                        var field = $(this).closest('.forminator-field');
     3650                        var label = field.find('.forminator-label');
     3651
     3652                        if (label.length) {
     3653                            field.addClass('forminator-stripe-floating');
     3654                            // Add floating class
     3655                            label.addClass('forminator-floating--input');
     3656                        }
     3657                    });
     3658                }
     3659            }
     3660        },
     3661
     3662        responsive_captcha: function ( form_selector ) {
     3663            $( form_selector ).find('.forminator-g-recaptcha').each(function () {
     3664                var badge = $(this).data('badge'); // eslint-disable-line
     3665                if ($(this).is(':visible') && 'inline' === badge ) {
     3666                    var width = $(this).parent().width(),
     3667                        scale = 1;
     3668                    if (width < 302) {
     3669                        scale = width / 302;
     3670                    }
     3671                    $(this).css('transform', 'scale(' + scale + ')');
     3672                    $(this).css('-webkit-transform', 'scale(' + scale + ')');
     3673                    $(this).css('transform-origin', '0 0');
     3674                    $(this).css('-webkit-transform-origin', '0 0');
     3675                }
     3676            });
     3677        },
     3678
     3679        init_pagination: function ( form_selector ) {
     3680            var self      = this,
     3681                num_pages = $( form_selector ).find(".forminator-pagination").length,
     3682                hash      = window.location.hash,
     3683                hashStep  = false,
     3684                step      = 0;
     3685
     3686            if (num_pages > 0) {
     3687                //find from hash
     3688                if (typeof hash !== "undefined" && hash.indexOf('step-') >= 0) {
     3689                    hashStep = true;
     3690                    step     = hash.substr(6, 8);
     3691                }
     3692
     3693                $(this.element).forminatorFrontPagination({
     3694                    totalSteps: num_pages,
     3695                    hashStep: hashStep,
     3696                    step: step,
     3697                    inline_validation: self.settings.inline_validation,
     3698                    submitButtonClass: self.settings.submit_button_class
     3699                });
     3700            }
     3701        },
     3702
     3703        activate_field: function () {
     3704
     3705            var form     = $( this.element );
     3706            var input    = form.find( '.forminator-input' );
     3707            var textarea = form.find( '.forminator-textarea' );
     3708
     3709            function classFilled( el ) {
     3710
     3711                var element       = $( el );
     3712                var elementValue  = element.val().trim();
     3713                var elementField  = element.closest( '.forminator-field' );
     3714                var elementAnswer = element.closest( '.forminator-poll--answer' );
     3715
     3716                var filledClass = 'forminator-is_filled';
     3717
     3718                if ( '' !== elementValue ) {
     3719                    elementField.addClass( filledClass );
     3720                    elementAnswer.addClass( filledClass );
     3721                } else {
     3722                    elementField.removeClass( filledClass );
     3723                    elementAnswer.removeClass( filledClass );
     3724                }
     3725
     3726                element.change( function( e ) {
     3727
     3728                    if ( '' !== elementValue ) {
     3729                        elementField.addClass( filledClass );
     3730                        elementAnswer.addClass( filledClass );
     3731                    } else {
     3732                        elementField.removeClass( filledClass );
     3733                        elementAnswer.removeClass( filledClass );
     3734                    }
     3735
     3736                    e.stopPropagation();
     3737
     3738                });
     3739            }
     3740
     3741            function classHover( el ) {
     3742
     3743                var element       = $( el );
     3744                var elementField  = element.closest( '.forminator-field' );
     3745                var elementAnswer = element.closest( '.forminator-poll--answer' );
     3746
     3747                var hoverClass = 'forminator-is_hover';
     3748
     3749                element.on( 'mouseover', function( e ) {
     3750                    elementField.addClass( hoverClass );
     3751                    elementAnswer.addClass( hoverClass );
     3752                    e.stopPropagation();
     3753                }).on( 'mouseout', function( e ) {
     3754                    elementField.removeClass( hoverClass );
     3755                    elementAnswer.removeClass( hoverClass );
     3756                    e.stopPropagation();
     3757                });
     3758            }
     3759
     3760            function classActive( el ) {
     3761
     3762                var element       = $( el );
     3763                var elementField  = element.closest( '.forminator-field' );
     3764                var elementAnswer = element.closest( '.forminator-poll--answer' );
     3765
     3766                var activeClass = 'forminator-is_active';
     3767
     3768                element.focus( function( e ) {
     3769                    elementField.addClass( activeClass );
     3770                    elementAnswer.addClass( activeClass );
     3771                    e.stopPropagation();
     3772                }).blur( function( e ) {
     3773                    elementField.removeClass( activeClass );
     3774                    elementAnswer.removeClass( activeClass );
     3775                    e.stopPropagation();
     3776                });
     3777            }
     3778
     3779            function classError( el ) {
     3780
     3781                var element       = $( el );
     3782                var elementValue  = element.val().trim();
     3783                var elementField  = element.closest( '.forminator-field' );
     3784                var elementTime   = element.attr( 'data-field' );
     3785
     3786                var timePicker = element.closest( '.forminator-timepicker' );
     3787                var timeColumn = timePicker.parent();
     3788
     3789                var errorField = elementField.find( '.forminator-error-message' );
     3790
     3791                var errorClass = 'forminator-has_error';
     3792
     3793                element.on( 'load change keyup keydown', function( e ) {
     3794
     3795                    if ( 'undefined' !== typeof elementTime && false !== elementTime ) {
     3796
     3797                        if ( 'hours' === element.data( 'field' ) ) {
     3798
     3799                            var hoursError = timeColumn.find( '.forminator-error-message[data-error-field="hours"]' );
     3800
     3801                            if ( '' !== elementValue && 0 !== hoursError.length ) {
     3802                                hoursError.remove();
     3803                            }
     3804                        }
     3805
     3806                        if ( 'minutes' === element.data( 'field' ) ) {
     3807
     3808                            var minutesError = timeColumn.find( '.forminator-error-message[data-error-field="minutes"]' );
     3809
     3810                            if ( '' !== elementValue && 0 !== minutesError.length ) {
     3811                                minutesError.remove();
     3812                            }
     3813                        }
     3814                    } else {
     3815
     3816                        if ( '' !== elementValue && errorField.text() ) {
     3817                            errorField.remove();
     3818                            elementField.removeClass( errorClass );
     3819                        }
     3820                    }
     3821
     3822                    e.stopPropagation();
     3823
     3824                });
     3825            }
     3826
     3827            if ( input.length ) {
     3828
     3829                input.each( function() {
     3830                    //classFilled( this );
     3831                    //classHover( this );
     3832                    //classActive( this );
     3833                    classError( this );
     3834                });
     3835            }
     3836
     3837            if ( textarea.length ) {
     3838
     3839                textarea.each( function() {
     3840                    //classFilled( this );
     3841                    //classHover( this );
     3842                    //classActive( this );
     3843                    classError( this );
     3844                });
     3845            }
     3846
     3847            form.find('select.forminator-select2 + .forminator-select').each(function () {
     3848
     3849                var $select = $(this);
     3850
     3851                // Set field active class on hover
     3852                $select.on('mouseover', function (e) {
     3853                    e.stopPropagation();
     3854                    $(this).closest('.forminator-field').addClass('forminator-is_hover');
     3855
     3856                }).on('mouseout', function (e) {
     3857                    e.stopPropagation();
     3858                    $(this).closest('.forminator-field').removeClass('forminator-is_hover');
     3859
     3860                });
     3861
     3862                // Set field active class on focus
     3863                $select.on('click', function (e) {
     3864                    e.stopPropagation();
     3865                    checkSelectActive();
     3866                    if ($select.hasClass('select2-container--open')) {
     3867                        $(this).closest('.forminator-field').addClass('forminator-is_active');
     3868                    } else {
     3869                        $(this).closest('.forminator-field').removeClass('forminator-is_active');
     3870                    }
     3871
     3872                });
     3873
     3874
     3875            });
     3876
     3877            function checkSelectActive() {
     3878                if (form.find('.select2-container').hasClass('select2-container--open')) {
     3879                    setTimeout(checkSelectActive, 300);
     3880                } else {
     3881                    form.find('.select2-container').closest('.forminator-field').removeClass('forminator-is_active');
     3882                }
     3883            }
     3884        },
     3885
     3886        field_counter: function ( form_selector ) {
     3887            var form = $( form_selector ),
     3888                submit_button = form.find('.forminator-button-submit');
     3889
     3890            form.find('.forminator-input, .forminator-textarea').each(function () {
     3891                var $input   = $(this),
     3892                    numwords = 0,
     3893                    count    = 0;
     3894
     3895                $input.on('keydown', function (e) {
     3896                    if ( ! $(this).hasClass('forminator-textarea') && e.keyCode === 13 ) {
     3897                        e.preventDefault();
     3898                        if ( submit_button.is(":visible") ) {
     3899                            submit_button.trigger('click');
     3900                        }
     3901                        return false;
     3902                    }
     3903                });
     3904
     3905                $input.on('change keyup keydown', function (e) {
     3906                    e.stopPropagation();
     3907                    var $field = $(this).closest('.forminator-col'),
     3908                        $limit = $field.find('.forminator-description span'),
     3909                            fieldVal = sanitize_text_field( $(this).val() )
     3910                    ;
     3911
     3912                    if ($limit.length) {
     3913                        if ($limit.data('limit')) {
     3914                            var field_value = fieldVal.replace( /<[^>]*>/g, '' );
     3915                            if ($limit.data('type') !== "words") {
     3916                                count = $( '<div>' + field_value + '</div>' ).text().length;
     3917                            } else {
     3918                                count = field_value.trim().split(/\s+/).length;
     3919
     3920                                // Prevent additional words from being added when limit is reached.
     3921                                numwords = field_value.trim().split(/\s+/).length;
     3922                                if ( numwords >= $limit.data( 'limit' ) ) {
     3923                                    // Allow to delete and backspace when limit is reached.
     3924                                    if( e.which === 32 ) {
     3925                                        e.preventDefault();
     3926                                    }
     3927                                }
     3928                            }
     3929                            $limit.html(count + ' / ' + $limit.data('limit'));
     3930                        }
     3931                    }
     3932                });
     3933
     3934            });
     3935        },
     3936
     3937        field_number: function ( form_selector ) {
     3938            // var form = $(this.element);
     3939            // form.find('input[type=number]').on('change keyup', function () {
     3940            //  if( ! $(this).val().match(/^\d+$/) ){
     3941            //      var sanitized = $(this).val().replace(/[^0-9]/g, '');
     3942            //      $(this).val(sanitized);
     3943            //  }
     3944            // });
     3945            var form = $( form_selector );
     3946            form.find('input[type=number]').each(function () {
     3947                $(this).keypress(function (e) {
     3948                    var i;
     3949                    var allowed = [44, 45, 46];
     3950                    var key     = e.which;
     3951
     3952                    for (i = 48; i < 58; i++) {
     3953                        allowed.push(i);
     3954                    }
     3955
     3956                    if (!(allowed.indexOf(key) >= 0)) {
     3957                        e.preventDefault();
     3958                    }
     3959                });
     3960            });
     3961
     3962            form.find('.forminator-number--field, .forminator-currency, .forminator-calculation').each(function () {
     3963                var inputType = $( this ).attr( 'type' );
     3964                if ( 'number' === inputType ) {
     3965                    var decimals = $( this ).data( 'decimals' );
     3966                    $( this ).change( function ( e ) {
     3967                        this.value = parseFloat( this.value ).toFixed( decimals );
     3968                    });
     3969                    $( this ).trigger( 'change' );
     3970                }
     3971                /*
     3972                * If you need to retrieve the formatted (masked) value, you can use something like this:
     3973                * $element.inputmask({'autoUnmask' : false});
     3974                * var value = $element.val();
     3975                * $element.inputmask({'autoUnmask' : true});
     3976                */
     3977                $( this ).inputmask({
     3978                    'alias': 'decimal',
     3979                    'rightAlign': false,
     3980                    'digitsOptional': false,
     3981                    'showMaskOnHover': false,
     3982                    'autoUnmask' : true, // Automatically unmask the value when retrieved - this prevents the "Maximum call stack size exceeded" console error that happens in some forms that contain number/calculation fields with localized masks.
     3983                    'removeMaskOnSubmit': true,
     3984                });
     3985            });
     3986
     3987            // Fixes the 2nd number input bug: https://incsub.atlassian.net/browse/FOR-3033
     3988            form.find( 'input[type=number]' ).on( 'mouseout', function() {
     3989                $( this ).trigger( 'blur' );
     3990            });
     3991        },
     3992
     3993        field_time: function () {
     3994            var self = this;
     3995            $('.forminator-input-time').on('input', function (e) {
     3996                var $this = $(this),
     3997                    value = $this.val()
     3998                ;
     3999
     4000                // Allow only 2 digits for time fields
     4001                if (value && value.length >= 2) {
     4002                    $this.val(value.substr(0, 2));
     4003                }
     4004            });
     4005
     4006            // Apply time limits.
     4007            this.$el.find( '.forminator-timepicker' ).each( function( i, el ) {
     4008                var $tp   = $( el ),
     4009                    start = $tp.data( 'start-limit' ),
     4010                    end   = $tp.data( 'end-limit' )
     4011                ;
     4012
     4013                if ( 'undefined' !== typeof start && 'undefined' !== typeof end ) {
     4014                    var hourSelect = $tp.find( '.time-hours' ),
     4015                        initHours  = hourSelect.html()
     4016                    ;
     4017
     4018                    // Reset right away.
     4019                    self.resetTimePicker( $tp, start, end );
     4020                    // Reset onchange.
     4021                    $tp.find( '.time-ampm' ).on( 'change', function() {
     4022                        hourSelect.val('');
     4023                        hourSelect.html( initHours );
     4024                        self.resetTimePicker( $tp, start, end );
     4025                        setTimeout(
     4026                            function() {
     4027                                $tp.find( '.forminator-field' ).removeClass( 'forminator-has_error' );
     4028                            },
     4029                            10
     4030                        );
     4031                    });
     4032                }
     4033            });
     4034        },
     4035
     4036        // Remove hour options that are outside the limits.
     4037        resetTimePicker: function ( timePicker, start, end ) {
     4038            var meridiem = timePicker.find( '.time-ampm' ),
     4039                [ startTime, startModifier ] = start.split(' '),
     4040                [ startHour, startMinute ] = startTime.split(':'),
     4041                startHour = parseInt( startHour ),
     4042                [ endTime, endModifier ] = end.split(' '),
     4043                [ endHour, endMinute ] = endTime.split(':'),
     4044                endHour = parseInt( endHour )
     4045                ;
     4046
     4047            if ( startModifier === endModifier ) {
     4048                meridiem.find( 'option[value!="' + endModifier + '"]' ).remove();
     4049            }
     4050
     4051            timePicker.find( '.time-hours' ).children().each( function( optionIndex, optionEl ) {
     4052                var optionValue = parseInt( optionEl.value );
     4053
     4054                if (
     4055                    '' !== optionValue &&
     4056                    ( optionValue < startHour || ( 0 !== startHour && 12 === optionValue ) ) &&
     4057                    meridiem.val() === startModifier
     4058                ) {
     4059                    optionEl.remove();
     4060                }
     4061
     4062                if (
     4063                    '' !== optionValue &&
     4064                    optionValue > endHour &&
     4065                    12 !== optionValue &&
     4066                    meridiem.val() === endModifier
     4067                ) {
     4068                    optionEl.remove();
     4069                }
     4070            });
     4071        },
     4072
     4073        init_login_2FA: function () {
     4074            var self = this;
     4075            this.two_factor_providers( 'totp' );
     4076            $('body').on('click', '.forminator-2fa-link', function () {
     4077                self.$el.find('#login_error').remove();
     4078                self.$el.find('.notification').empty();
     4079                var slug = $(this).data('slug');
     4080                self.two_factor_providers( slug );
     4081                if ('fallback-email' === slug) {
     4082                    self.resend_code();
     4083                }
     4084            });
     4085            this.$el.find('.wpdef-2fa-email-resend input').on('click', function () {
     4086                self.resend_code();
     4087            });
     4088        },
     4089        two_factor_providers: function ( slug ) {
     4090            var self = this;
     4091            self.$el.find('.forminator-authentication-box').hide();
     4092            self.$el.find('.forminator-authentication-box input').attr( 'disabled', true );
     4093            self.$el.find( '#forminator-2fa-' + slug ).show();
     4094            self.$el.find( '#forminator-2fa-' + slug + ' input' ).attr( 'disabled', false );
     4095            if ( self.$el.find('.forminator-2fa-link').length > 0 ) {
     4096                self.$el.find('.forminator-2fa-link').hide();
     4097                self.$el.find('.forminator-2fa-link:not(#forminator-2fa-link-'+ slug +')').each(function() {
     4098                    self.$el.find('.forminator-auth-method').val( slug );
     4099                    $( this ).find('input').attr( 'disabled', false );
     4100                    $( this ).show();
     4101                });
     4102            }
     4103        },
     4104
     4105        // Logic for FallbackEmail method.
     4106        resend_code: function () {
     4107            // Work with the button 'Resen Code'.
     4108            var self  = this;
     4109            var that  = $('input[name="button_resend_code"]');
     4110            var token = $('.forminator-auth-token');
     4111            let data = {
     4112                action: 'forminator_2fa_fallback_email',
     4113                data: JSON.stringify({
     4114                    'token': token
     4115                })
     4116            };
     4117            $.ajax({
     4118                type: 'POST',
     4119                url: window.ForminatorFront.ajaxUrl,
     4120                data: data,
     4121                beforeSend: function () {
     4122                    that.attr('disabled', 'disabled');
     4123                    $('.def-ajaxloader').show();
     4124                },
     4125                success: function (data) {
     4126                    that.removeAttr('disabled');
     4127                    $('.def-ajaxloader').hide();
     4128                    $('.notification').text(data.data.message);
     4129                }
     4130            })
     4131        },
     4132
     4133        material_field: function () {
     4134            /*
     4135            var form = $(this.element);
     4136            if (form.is('.forminator-design--material')) {
     4137                var $input    = form.find('.forminator-input--wrap'),
     4138                    $textarea = form.find('.forminator-textarea--wrap'),
     4139                    $date     = form.find('.forminator-date'),
     4140                    $product  = form.find('.forminator-product');
     4141
     4142                var $navigation = form.find('.forminator-pagination--nav'),
     4143                    $navitem    = $navigation.find('li');
     4144
     4145                $('<span class="forminator-nav-border"></span>').insertAfter($navitem);
     4146
     4147                $input.prev('.forminator-field--label').addClass('forminator-floating--input');
     4148                $input.closest('.forminator-phone-intl').prev('.forminator-field--label').addClass('forminator-floating--input');
     4149                $textarea.prev('.forminator-field--label').addClass('forminator-floating--textarea');
     4150
     4151                if ($date.hasClass('forminator-has_icon')) {
     4152                    $date.prev('.forminator-field--label').addClass('forminator-floating--date');
     4153                } else {
     4154                    $date.prev('.forminator-field--label').addClass('forminator-floating--input');
     4155                }
     4156            }
     4157            */
     4158        },
     4159
     4160        toggle_file_input: function() {
     4161
     4162            var $form = $( this.element );
     4163
     4164            $form.find( '.forminator-file-upload' ).each( function() {
     4165
     4166                var $field = $( this );
     4167                var $input = $field.find( 'input' );
     4168                var $remove = $field.find( '.forminator-button-delete' );
     4169
     4170                // Toggle remove button depend on input value
     4171                if ( '' !== $input.val() ) {
     4172                    $remove.show(); // Show remove button
     4173                } else {
     4174                    $remove.hide(); // Hide remove button
     4175                }
     4176            });
     4177        },
     4178
     4179        upload_field: function ( form_selector ) {
     4180            var self = this,
     4181                form = $( form_selector )
     4182            ;
     4183            // Toggle file remove button
     4184            this.toggle_file_input();
     4185
     4186            // Handle remove file button click
     4187            form.find( '.forminator-button-delete' ).on('click', function (e) {
     4188
     4189                e.preventDefault();
     4190
     4191                var $self  = $( this ),
     4192                    $input = $self.siblings('input'),
     4193                    $label = $self.closest( '.forminator-file-upload' ).find('> span')
     4194                    ;
     4195
     4196                // Cleanup
     4197                $input.val('');
     4198                $label.html( $label.data( 'empty-text' ) );
     4199                $self.hide();
     4200
     4201            });
     4202
     4203            form.find( '.forminator-input-file, .forminator-input-file-required' ).on('change', function () {
     4204                var $nameLabel = $(this).closest( '.forminator-file-upload' ).find( '> span' ),
     4205                    vals = $(this).val(),
     4206                    val  = vals.length ? vals.split('\\').pop() : ''
     4207                ;
     4208
     4209                $nameLabel.text(val);
     4210
     4211                self.toggle_file_input();
     4212            });
     4213
     4214            form.find( '.forminator-button-upload' ).off();
     4215            form.find( '.forminator-button-upload' ).on( 'click', function (e) {
     4216                e.preventDefault();
     4217
     4218                var $id        = $(this).attr('data-id'),
     4219                    $target    = form.find('input#' + $id)
     4220                    ;
     4221
     4222                $target.trigger('click');
     4223            });
     4224
     4225            form.find( '.forminator-input-file, .forminator-input-file-required' ).on('change', function (e) {
     4226
     4227                e.preventDefault();
     4228
     4229                var $file   = $(this)[0].files.length,
     4230                    $remove = $(this).find('.forminator-button-delete');
     4231
     4232                if ($file === 0) {
     4233                    $remove.hide();
     4234                } else {
     4235                    $remove.show();
     4236                }
     4237
     4238            });
     4239        },
     4240
     4241        // Remove duplicate fields created by other plugins/themes
     4242        maybeRemoveDuplicateFields: function ( form_selector ) {
     4243            var form = $( form_selector );
     4244
     4245            // Check for Neira Lite theme
     4246            if ( $( document ).find( "link[id='neira-lite-style-css']" ).length ) {
     4247                var duplicateSelect  = form.find( '.forminator-select-container' ).next( '.chosen-container' ),
     4248                    duplicateSelect2 = form.find( 'select.forminator-select2 + .forminator-select' ).next( '.chosen-container' ),
     4249                    duplicateAddress = form.find( '.forminator-select' ).next( '.chosen-container' )
     4250                ;
     4251
     4252                if ( 0 !== duplicateSelect.length ) {
     4253                    duplicateSelect.remove();
     4254                }
     4255                if ( 0 !== duplicateSelect2.length ) {
     4256                    duplicateSelect2.remove();
     4257                }
     4258                if ( 0 !== duplicateAddress.length ) {
     4259                    duplicateAddress.remove();
     4260                }
     4261            }
     4262        },
     4263
     4264        renderCaptcha: function (captcha_field) {
     4265            var self = this;
     4266            //render captcha only if not rendered
     4267            if (typeof $(captcha_field).data('forminator-recapchta-widget') === 'undefined') {
     4268                var size = $(captcha_field).data('size'),
     4269                    data = {
     4270                        sitekey: $(captcha_field).data('sitekey'),
     4271                        theme: $(captcha_field).data('theme'),
     4272                        size: size
     4273                    };
     4274
     4275                if (size === 'invisible') {
     4276                    data.badge    = $(captcha_field).data('badge');
     4277                    data.callback = function (token) {
     4278                        $(self.element).trigger('submit.frontSubmit');
     4279                    };
     4280                } else {
     4281                    data.callback = function () {
     4282                        $(captcha_field).parent( '.forminator-col' )
     4283                            .removeClass( 'forminator-has_error' )
     4284                            .remove( '.forminator-error-message' );
     4285                    };
     4286                }
     4287
     4288                if (data.sitekey !== "") {
     4289                    // noinspection Annotator
     4290                    var widget = window.grecaptcha.render(captcha_field, data);
     4291                    // mark as rendered
     4292                    $(captcha_field).data('forminator-recapchta-widget', widget);
     4293                    this.addCaptchaAria( captcha_field );
     4294                    this.responsive_captcha();
     4295                }
     4296            }
     4297        },
     4298
     4299        renderHcaptcha: function ( captcha_field ) {
     4300            var self = this;
     4301            //render hcaptcha only if not rendered
     4302            if (typeof $( captcha_field ).data( 'forminator-hcaptcha-widget' ) === 'undefined') {
     4303                var size = $( captcha_field ).data( 'size' ),
     4304                    data = {
     4305                        sitekey: $( captcha_field ).data( 'sitekey' ),
     4306                        theme: $( captcha_field ).data( 'theme' ),
     4307                        size: size
     4308                    };
     4309
     4310                if ( size === 'invisible' ) {
     4311                    data.callback = function ( token ) {
     4312                        $( self.element ).trigger( 'submit.frontSubmit' );
     4313                    };
     4314                } else {
     4315                    data.callback = function () {
     4316                        $( captcha_field ).parent( '.forminator-col' )
     4317                            .removeClass( 'forminator-has_error' )
     4318                            .remove( '.forminator-error-message' );
     4319                    };
     4320                }
     4321
     4322                if ( data.sitekey !== "" ) {
     4323                    // noinspection Annotator
     4324                    var widgetId = hcaptcha.render( captcha_field, data );
     4325                    // mark as rendered
     4326                    $( captcha_field ).data( 'forminator-hcaptcha-widget', widgetId );
     4327                    // this.addCaptchaAria( captcha_field );
     4328                    // this.responsive_captcha();
     4329                }
     4330            }
     4331        },
     4332
     4333        addCaptchaAria: function ( captcha_field ) {
     4334            var gRecaptchaResponse = $( captcha_field ).find( '.g-recaptcha-response' ),
     4335                gRecaptcha = $( captcha_field ).find( '>div' );
     4336
     4337            if ( 0 !== gRecaptchaResponse.length ) {
     4338                gRecaptchaResponse.attr( "aria-hidden", "true" );
     4339                gRecaptchaResponse.attr( "aria-label", "do not use" );
     4340                gRecaptchaResponse.attr( "aria-readonly", "true" );
     4341            }
     4342            if ( 0 !== gRecaptcha.length ) {
     4343                gRecaptcha.css( 'z-index', 99 );
     4344            }
     4345        },
     4346
     4347        hide: function () {
     4348            this.$el.hide();
     4349        },
     4350        /**
     4351         * Return JSON object if possible
     4352         *
     4353         * We tried our best here
     4354         * if there is an error/exception, it will return empty object/array
     4355         *
     4356         * @param string
     4357         * @param type ('array'/'object')
     4358         */
     4359        maybeParseStringToJson: function (string, type) {
     4360            var object = {};
     4361            // already object
     4362            if (typeof string === 'object') {
     4363                return string;
     4364            }
     4365
     4366            if (type === 'object') {
     4367                string = '{' + string.trim() + '}';
     4368            } else if (type === 'array') {
     4369                string = '[' + string.trim() + ']';
     4370            } else {
     4371                return {};
     4372            }
     4373
     4374            try {
     4375                // remove trailing comma, duh
     4376                /**
     4377                 * find `,`, after which there is no any new attribute, object or array.
     4378                 * New attribute could start either with quotes (" or ') or with any word-character (\w).
     4379                 * New object could start only with character {.
     4380                 * New array could start only with character [.
     4381                 * New attribute, object or array could be placed after a bunch of space-like symbols (\s).
     4382                 *
     4383                 * Feel free to hack this regex if you got better idea
     4384                 * @type {RegExp}
     4385                 */
     4386                var trailingCommaRegex = /\,(?!\s*?[\{\[\"\'\w])/g;
     4387                string                 = string.replace(trailingCommaRegex, '');
     4388
     4389                object = JSON.parse(string);
     4390            } catch (e) {
     4391                console.error(e.message);
     4392                if (type === 'object') {
     4393                    object = {};
     4394                } else if (type === 'array') {
     4395                    object = [];
     4396                }
     4397            }
     4398
     4399            return object;
     4400
     4401        },
     4402
     4403        /**
     4404         * Render Stripe once it's available
     4405         *
     4406         * @param string
     4407         * @param type ('array'/'object')
     4408         */
     4409        renderStripe: function( form, stripe_payment, stripeLoadCounter = 0 ) {
     4410            var self = this;
     4411
     4412            setTimeout( function() {
     4413                stripeLoadCounter++;
     4414
     4415                if ( 'undefined' !== typeof Stripe ) {
     4416
     4417                    $( form.element ).forminatorFrontPayment({
     4418                        type: 'stripe',
     4419                        paymentEl: stripe_payment,
     4420                        paymentRequireSsl: form.settings.payment_require_ssl,
     4421                        generalMessages: form.settings.general_messages,
     4422                        has_loader: form.settings.has_loader,
     4423                        loader_label: form.settings.loader_label,
     4424                    });
     4425
     4426                // Retry checking for 30 seconds
     4427                } else if ( stripeLoadCounter < 300 ) {
     4428                    self.renderStripe( form, stripe_payment, stripeLoadCounter );
     4429                } else {
     4430                    console.error( 'Failed to load Stripe.' );
     4431                }
     4432            }, 100 );
     4433        },
     4434
     4435        // Enable save draft button once a change is made
     4436        maybe_enable_save_draft: function ( $saveDraft, initialData ) {
     4437            var changedData = this.$el.serializeArray(),
     4438                hasChanged  = false,
     4439                hasSig      = this.$el.find( '.forminator-field-signature' ).length ? true : false
     4440                ;
     4441
     4442            // Remove signature field from changedData, will process later
     4443            changedData = changedData.filter( function( val ) {
     4444                return val.name.indexOf( 'ctlSignature' ) === -1 ;
     4445            });
     4446
     4447            initialData = JSON.stringify( initialData );
     4448            changedData = JSON.stringify( changedData );
     4449
     4450            // Check for field changes
     4451            if ( initialData !== changedData ) {
     4452                hasChanged = true;
     4453            }
     4454
     4455            // Check for signature change
     4456            if ( hasSig && false === hasChanged ) {
     4457                this.$el.find( '.forminator-field-signature' ).each( function(e) {
     4458                    var sigPrefix = $( this ).find( '.signature-prefix' ).val();
     4459
     4460                    if (
     4461                        0 !== $( this ).find( '#ctlSignature' + sigPrefix + '_data' ).length &&
     4462                        '' !== $( this ).find( '#ctlSignature' + sigPrefix + '_data' ).val()
     4463                    ) {
     4464                        hasChanged = true;
     4465                        return false;
     4466                    }
     4467                });
     4468            }
     4469
     4470            if ( hasChanged ) {
     4471                $saveDraft.removeClass( 'disabled' );
     4472            } else {
     4473                $saveDraft.addClass( 'disabled' );
     4474            }
     4475        },
     4476
     4477        handleDiviPopup: function () {
     4478            var self = this;
     4479            if ( 'undefined' !== typeof DiviArea ) {
     4480                DiviArea.addAction( 'show_area', function( area ) {
     4481                    setTimeout(
     4482                        function() {
     4483                            self.init();
     4484                            forminatorSignInit();
     4485                            forminatorSignatureResize();
     4486                        },
     4487                        100
     4488                    );
     4489                });
     4490            }
     4491        },
     4492
     4493        disableFields: function () {
     4494            this.$el.addClass( 'forminator-fields-disabled' );
     4495        },
     4496
     4497        // Check if Complianz has added a blocker for reCaptcha.
     4498        checkComplianzBlocker: function () {
     4499            var complianzBlocker = this.$el.find( '.cmplz-blocked-content-container' );
     4500
     4501            if ( complianzBlocker.length > 0 ) {
     4502                var row = complianzBlocker.closest( '.forminator-row' );
     4503
     4504                this.disableFields();
     4505                row.insertBefore( this.$el.find( '.forminator-row' ).first() );
     4506                row.css({ 'pointer-events': 'all', 'opacity': '1' });
     4507                row.find( '*' ).css( 'pointer-events', 'all' );
     4508
     4509                // For paginated.
     4510                if ( row.closest( '.forminator-pagination--content' ).length > 0 ) {
     4511                    row.closest( '.forminator-pagination--content' ).css({ 'pointer-events': 'all', 'opacity': '1' });
     4512                    row.nextAll( '.forminator-row' ).css({ 'opacity': '0.5' });
     4513                }
     4514
     4515                // Reload window if accepted.
     4516                $( 'body' ).on( 'click', '.cmplz-blocked-content-notice, .cmplz-accept', function() {
     4517                    setTimeout(
     4518                        function() {
     4519                            window.location.reload();
     4520                        },
     4521                        50
     4522                    );
     4523                });
     4524            }
     4525        },
     4526    });
     4527
     4528    // A really lightweight plugin wrapper around the constructor,
     4529    // preventing against multiple instantiations
     4530    $.fn[pluginName] = function (options) {
     4531        return this.each(function () {
     4532            if (!$.data(this, pluginName)) {
     4533                $.data(this, pluginName, new ForminatorFront(this, options));
     4534            }
     4535        });
     4536    };
     4537
     4538    // hook from wp_editor tinymce
     4539    $(document).on('tinymce-editor-init', function (event, editor) {
     4540        var editor_id = editor.id,
     4541            $field = $('#' + editor_id ).closest('.forminator-col')
     4542        ;
     4543
     4544        // trigger editor change to save value to textarea,
     4545        // default wp tinymce textarea update only triggered when submit
     4546        var count  = 0;
     4547        editor.on('change', function () {
     4548            // only forminator
     4549            if ( -1 !== editor_id.indexOf( 'forminator-field-textarea-' ) ) {
     4550                editor.save();
     4551                $field.find( '#' + editor_id ).trigger( 'change' );
     4552            }
     4553
     4554            if ( -1 !== editor_id.indexOf( 'forminator-field-post-content-' ) ) {
     4555                editor.save();
     4556                $field.find( '#' + editor_id ).trigger( 'change' );
     4557            }
     4558        });
     4559
     4560        // Trigger onblur.
     4561        editor.on( 'blur', function () {
     4562            // only forminator
     4563            if (
     4564                -1 !== editor_id.indexOf( 'forminator-field-textarea-' ) ||
     4565                -1 !== editor_id.indexOf( 'forminator-field-post-content-' )
     4566            ) {
     4567                $field.find( '#' + editor_id ).valid();
     4568            }
     4569        });
     4570
     4571        // Make the visual editor and html editor the same height
     4572        if ( $( '#' + editor.id + '_ifr' ).is( ':visible' ) ) {
     4573            $( '#' + editor.id + '_ifr' ).height( $( '#' + editor.id ).height() );
     4574        }
     4575
     4576        // Add aria-describedby.
     4577        if ( -1 !== editor_id.indexOf( 'forminator' ) ) {
     4578            $( '#' + editor_id ).closest( '.wp-editor-wrap' ).attr(
     4579                'aria-describedby',
     4580                editor_id + '-description'
     4581            );
     4582        }
     4583    });
     4584
     4585    $( document ).on( 'click', '.forminator-copy-btn', function( e ) {
     4586        forminatorCopyTextToClipboard( $( this ).prev( '.forminator-draft-link' ).val() );
     4587        if ( ! $( this ).hasClass( 'copied' ) ) {
     4588            $( this ).addClass( 'copied' )
     4589            $( this ).prepend( '&check;  ' );
     4590        }
     4591    } );
     4592
     4593    // Copy: Async + Fallback
     4594    // https://stackoverflow.com/a/30810322
     4595    function forminatorFallbackCopyTextToClipboard( text ) {
     4596        var textArea = document.createElement("textarea");
     4597        textArea.value = text;
     4598
     4599        // Avoid scrolling to bottom
     4600        textArea.style.top = "0";
     4601        textArea.style.left = "0";
     4602        textArea.style.position = "fixed";
     4603
     4604        document.body.appendChild(textArea);
     4605        textArea.focus();
     4606        textArea.select();
     4607
     4608        try {
     4609            var successful = document.execCommand('copy');
     4610            var msg = successful ? 'successful' : 'unsuccessful';
     4611            // console.log('Fallback: Copying text command was ' + msg);
     4612        } catch (err) {
     4613            // console.error('Fallback: Oops, unable to copy', err);
     4614        }
     4615
     4616        document.body.removeChild(textArea);
     4617    }
     4618
     4619    function forminatorCopyTextToClipboard (text ) {
     4620        if (!navigator.clipboard) {
     4621            forminatorFallbackCopyTextToClipboard(text);
     4622            return;
     4623        }
     4624        navigator.clipboard.writeText(text).then(function() {
     4625            // console.log('Async: Copying to clipboard was successful!');
     4626        }, function(err) {
     4627            // console.error('Async: Could not copy text: ', err);
     4628        });
     4629    }
     4630
     4631    // Focus to nearest input when label is clicked
     4632    function focus_to_nearest_input() {
     4633        $( '.forminator-custom-form' ).find( '.forminator-label' ).on( 'click', function ( e ) {
     4634            e.preventDefault();
     4635            var fieldLabel = $( this );
     4636
     4637            fieldLabel.next( '#' + fieldLabel.attr( 'for' ) ).focus();
     4638        });
     4639    }
     4640
     4641    focus_to_nearest_input();
     4642    $( document ).on( 'after.load.forminator', focus_to_nearest_input );
     4643
     4644    // Elementor Popup show event
     4645    jQuery( document ).on( 'elementor/popup/show', () => {
     4646        forminator_render_captcha();
     4647        forminator_render_hcaptcha();
     4648    } );
     4649
     4650    /**
     4651     * Sanitize the user input string.
     4652     *
     4653     * @param {string} string
     4654     */
     4655    function sanitize_text_field( string ) {
     4656        if ( typeof string === 'string') {
     4657            var str = String(string).replace(/[&\/\\#^+()$~%.'":*?<>{}!@]/g, '');
     4658            return str.trim();
     4659        }
     4660
     4661        return string;
     4662    }
     4663
     4664})(jQuery, window, document);
     4665
     4666// noinspection JSUnusedGlobalSymbols
     4667var forminator_render_captcha = function () {
     4668    // TODO: avoid conflict with another plugins that provide recaptcha
     4669    //  notify forminator front that grecaptcha has loaded and can be used
     4670    jQuery('.forminator-g-recaptcha').each(function () {
     4671        // find closest form
     4672        var thisCaptcha = jQuery(this),
     4673            form        = thisCaptcha.closest('form');
     4674
     4675        if ( form.length > 0 && '' === thisCaptcha.html() ) {
     4676            window.setTimeout( function() {
     4677                var forminatorFront = form.data( 'forminatorFront' );
     4678                if ( typeof forminatorFront !== 'undefined' ) {
     4679                    forminatorFront.renderCaptcha( thisCaptcha[0] );
     4680                }
     4681            }, 100 );
     4682        }
     4683    });
     4684};
     4685
     4686// noinspection JSUnusedGlobalSymbols
     4687var forminator_render_hcaptcha = function () {
     4688    // TODO: avoid conflict with another plugins that provide hcaptcha
     4689    //  notify forminator front that hcaptcha has loaded and can be used
     4690    jQuery('.forminator-hcaptcha').each(function () {
     4691        // find closest form
     4692        var thisCaptcha = jQuery(this),
     4693            form        = thisCaptcha.closest('form');
     4694
     4695        if ( form.length > 0 && '' === thisCaptcha.html() ) {
     4696            window.setTimeout( function() {
     4697                var forminatorFront = form.data( 'forminatorFront' );
     4698                if ( typeof forminatorFront !== 'undefined' ) {
     4699                    forminatorFront.renderHcaptcha( thisCaptcha[0] );
     4700                }
     4701            }, 100 );
     4702        }
     4703    });
     4704};
     4705
     4706// Source: http://stackoverflow.com/questions/497790
     4707var forminatorDateUtil = {
     4708    month_number: function( v ) {
     4709        var months_short = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
     4710        var months_full = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
     4711        if( v.constructor === Number ) {
     4712            return v;
     4713        }
     4714        var n = NaN;
     4715        if( v.constructor === String ) {
     4716            v = v.toLowerCase();
     4717            var index = months_short.indexOf( v );
     4718            if( index === -1 ) {
     4719                index = months_full.indexOf( v );
     4720            }
     4721            n = ( index === -1 ) ? NaN : index;
     4722        }
     4723
     4724        return n;
     4725    },
     4726    convert: function( d ) {
     4727        // Converts the date in d to a date-object. The input can be:
     4728        //   a date object: returned without modification
     4729        //  an array      : Interpreted as [year,month,day]. NOTE: month is 0-11.
     4730        //   a number     : Interpreted as number of milliseconds
     4731        //                  since 1 Jan 1970 (a timestamp)
     4732        //   a string     : Any format supported by the javascript engine, like
     4733        //                  "YYYY/MM/DD", "MM/DD/YYYY", "Jan 31 2009" etc.
     4734        //  an object     : Interpreted as an object with year, month and date
     4735        //                  attributes.  **NOTE** month is 0-11.
     4736        return (
     4737            d.constructor === Date   ? d :
     4738            d.constructor === Array  ? new Date( d[0], this.month_number( d[1] ), d[2] ) :
     4739            jQuery.isNumeric( d )    ? new Date( 1 * d ) :
     4740            d.constructor === Number ? new Date( d ) :
     4741            d.constructor === String ? new Date( d ) :
     4742            typeof d === "object"    ? new Date( d.year, this.month_number( d.month ), d.date ) :
     4743            NaN
     4744        );
     4745    },
     4746    compare: function( a, b ) {
     4747        // Compare two dates (could be of any type supported by the convert
     4748        // function above) and returns:
     4749        //  -1 : if a < b
     4750        //   0 : if a = b
     4751        //   1 : if a > b
     4752        // NaN : if a or b is an illegal date
     4753        // NOTE: The code inside isFinite does an assignment (=).
     4754        return (
     4755            isFinite( a = this.convert( a ).valueOf() ) &&
     4756            isFinite( b = this.convert( b ).valueOf() ) ?
     4757            ( a > b ) - ( a < b ) :
     4758            NaN
     4759        );
     4760    },
     4761    inRange: function( d, start, end ) {
     4762        // Checks if date in d is between dates in start and end.
     4763        // Returns a boolean or NaN:
     4764        //    true  : if d is between start and end (inclusive)
     4765        //    false : if d is before start or after end
     4766        //    NaN   : if one or more of the dates is illegal.
     4767        // NOTE: The code inside isFinite does an assignment (=).
     4768       return (
     4769            isFinite( d = this.convert( d ).valueOf() ) &&
     4770            isFinite( start = this.convert( start ).valueOf() ) &&
     4771            isFinite( end = this.convert( end ).valueOf() ) ?
     4772            start <= d && d <= end :
     4773            NaN
     4774        );
     4775    },
     4776
     4777    diffInDays: function( d1, d2 ) {
     4778        d1 = this.convert( d1 );
     4779        d2 = this.convert( d2 );
     4780        if( typeof d1.getMonth !== 'function' || typeof d2.getMonth !== 'function' ) {
     4781            return NaN;
     4782        }
     4783
     4784        var t2 = d2.getTime();
     4785        var t1 = d1.getTime();
     4786
     4787        return parseFloat((t2-t1)/(24*3600*1000));
     4788    },
     4789
     4790    diffInWeeks: function( d1, d2 ) {
     4791        d1 = this.convert( d1 );
     4792        d2 = this.convert( d2 );
     4793        if( typeof d1.getMonth !== 'function' || typeof d2.getMonth !== 'function' ) {
     4794            return NaN;
     4795        }
     4796
     4797        var t2 = d2.getTime();
     4798        var t1 = d1.getTime();
     4799
     4800        return parseInt((t2-t1)/(24*3600*1000*7));
     4801    },
     4802
     4803    diffInMonths: function( d1, d2 ) {
     4804        d1 = this.convert( d1 );
     4805        d2 = this.convert( d2 );
     4806        if( typeof d1.getMonth !== 'function' || typeof d2.getMonth !== 'function' ) {
     4807            return NaN;
     4808        }
     4809
     4810        var d1Y = d1.getFullYear();
     4811        var d2Y = d2.getFullYear();
     4812        var d1M = d1.getMonth();
     4813        var d2M = d2.getMonth();
     4814
     4815        return (d2M+12*d2Y)-(d1M+12*d1Y);
     4816    },
     4817
     4818    diffInYears: function( d1, d2 ) {
     4819        d1 = this.convert( d1 );
     4820        d2 = this.convert( d2 );
     4821        if( typeof d1.getMonth !== 'function' || typeof d2.getMonth !== 'function' ) {
     4822            return NaN;
     4823        }
     4824
     4825        return d2.getFullYear()-d1.getFullYear();
     4826    },
     4827};
     4828
     4829// the semi-colon before function invocation is a safety net against concatenated
     4830// scripts and/or other plugins which may not be closed properly.
     4831;// noinspection JSUnusedLocalSymbols
     4832(function ($, window, document, undefined) {
     4833
     4834    "use strict";
     4835
     4836    // undefined is used here as the undefined global variable in ECMAScript 3 is
     4837    // mutable (ie. it can be changed by someone else). undefined isn't really being
     4838    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     4839    // can no longer be modified.
     4840
     4841    // window and document are passed through as local variables rather than global
     4842    // as this (slightly) quickens the resolution process and can be more efficiently
     4843    // minified (especially when both are regularly referenced in your plugin).
     4844
     4845    // Create the defaults once
     4846    var pluginName = "forminatorFrontCalculate",
     4847        defaults   = {
     4848            forminatorFields: [],
     4849            generalMessages: {},
     4850        };
     4851
     4852    // The actual plugin constructor
     4853    function ForminatorFrontCalculate(element, options) {
     4854        this.element = element;
     4855        this.$el     = $(this.element);
     4856
     4857        // jQuery has an extend method which merges the contents of two or
     4858        // more objects, storing the result in the first object. The first object
     4859        // is generally empty as we don't want to alter the default options for
     4860        // future instances of the plugin
     4861        this.settings          = $.extend({}, defaults, options);
     4862        this._defaults         = defaults;
     4863        this._name             = pluginName;
     4864        this.calculationFields = [];
     4865        this.triggerInputs     = [];
     4866        this.isError           = false;
     4867        this.init();
     4868    }
     4869
     4870    // Avoid Plugin.prototype conflicts
     4871    $.extend(ForminatorFrontCalculate.prototype, {
     4872        init: function () {
     4873            var self              = this;
     4874
     4875            // find calculation fields
     4876            var calculationInputs = this.$el.find('input.forminator-calculation');
     4877
     4878            if (calculationInputs.length > 0) {
     4879
     4880                calculationInputs.each(function () {
     4881                    self.calculationFields.push({
     4882                        $input: $(this),
     4883                        formula: $(this).data('formula'),
     4884                        name: $(this).attr('name'),
     4885                        isHidden: $(this).data('isHidden'),
     4886                        precision: $(this).data('precision'),
     4887                        //separators: $(this).data('separators'),
     4888                    });
     4889
     4890                    // isHidden
     4891                    if ($(this).data('isHidden')) {
     4892                        $(this).closest('.forminator-col').addClass('forminator-hidden forminator-hidden-option');
     4893                        var rowField = $(this).closest('.forminator-row');
     4894                        rowField.addClass('forminator-hidden-option');
     4895
     4896                        if (rowField.find('> .forminator-col:not(.forminator-hidden)').length === 0) {
     4897                            rowField.addClass('forminator-hidden');
     4898                        }
     4899                    }
     4900                });
     4901
     4902                var memoizeTime = this.settings.memoizeTime || 300;
     4903
     4904                this.debouncedReCalculateAll = this.debounce(this.recalculateAll, 1000);
     4905                this.memoizeDebounceRender = this.memoize(this.recalculate, memoizeTime);
     4906
     4907                this.$el.on('forminator:field:condition:toggled', function (e) {
     4908                    self.debouncedReCalculateAll();
     4909                });
     4910
     4911                this.parseCalcFieldsFormula();
     4912                this.attachEventToTriggeringFields();
     4913                this.debouncedReCalculateAll();
     4914            }
     4915
     4916            this.$el.off( 'forminator:recalculate' ).on( 'forminator:recalculate', function() { self.recalculateAll(); } );
     4917        },
     4918
     4919        // Memoize an expensive function by storing its results.
     4920        memoize: function(func, wait) {
     4921            var memo = {};
     4922            var timeout;
     4923            var slice = Array.prototype.slice;
     4924
     4925            return function() {
     4926                var args = slice.call(arguments);
     4927
     4928                var later = function() {
     4929                    timeout = null;
     4930                    memo    = {};
     4931                };
     4932
     4933                clearTimeout(timeout);
     4934                timeout = setTimeout(later, wait);
     4935
     4936                if (args[0].name in memo) {
     4937                    return memo[args[0].name];
     4938                } else {
     4939                    return (memo[args[0].name] = func.apply(this, args));
     4940                }
     4941            }
     4942        },
     4943
     4944        debounce: function (func, wait, immediate) {
     4945            var timeout;
     4946            return function() {
     4947                var context = this, args = arguments;
     4948                var later = function() {
     4949                    timeout = null;
     4950                    if (!immediate) func.apply(context, args);
     4951                };
     4952                var callNow = immediate && !timeout;
     4953                clearTimeout(timeout);
     4954                timeout = setTimeout(later, wait);
     4955                if (callNow) func.apply(context, args);
     4956            };
     4957        },
     4958
     4959        parseCalcFieldsFormula: function () {
     4960            for (var i = 0; i < this.calculationFields.length; i++) {
     4961                var calcField = this.calculationFields[i];
     4962                var formula   = calcField.formula;
     4963
     4964                calcField.formula = formula;
     4965
     4966                this.calculationFields[i] = calcField;
     4967            }
     4968        },
     4969
     4970        findTriggerInputs: function (calcField) {
     4971            var formula               = calcField.formula;
     4972            var joinedFieldTypes      = this.settings.forminatorFields.join('|');
     4973            var incrementFieldPattern = "(" + joinedFieldTypes + ")-\\d+";
     4974            var pattern               = new RegExp('\\{(' + incrementFieldPattern + '(?:-min|-max)?)(\\-[A-Za-z-_]+)?(\\-[A-Za-z0-9-_]+)?\\}', 'g');
     4975
     4976            formula = this.maybeReplaceCalculationGroups(formula);
     4977
     4978            var matches;
     4979            while (matches = pattern.exec(formula)) {
     4980                var fullMatch = matches[0];
     4981                var groupSuffix = matches[4] || '';
     4982                var inputName = matches[1] + groupSuffix;
     4983                var fieldType = matches[2];
     4984
     4985                if (fullMatch === undefined || inputName === undefined || fieldType === undefined) {
     4986                    continue;
     4987                }
     4988
     4989                var formField = this.get_form_field(inputName);
     4990
     4991                if (!formField.length) {
     4992                    continue;
     4993                }
     4994
     4995                var calcFields = formField.data('calcFields');
     4996                if (calcFields === undefined) {
     4997                    calcFields = [];
     4998                }
     4999
     5000                var calcFieldAlreadyExist = false;
     5001
     5002                for (var j = 0; j < calcFields.length; j++) {
     5003                    var currentCalcField = calcFields[j];
     5004                    if (currentCalcField.name === calcField.name) {
     5005                        calcFieldAlreadyExist = true;
     5006                        break;
     5007                    }
     5008                }
     5009
     5010                if (!calcFieldAlreadyExist) {
     5011                    calcFields.push(calcField);
     5012                }
     5013
     5014                formField.data('calcFields', calcFields);
     5015                this.triggerInputs.push(formField);
     5016            }
     5017        },
     5018
     5019        // taken from forminatorFrontCondition
     5020        get_form_field: function (element_id) {
     5021            //find element by suffix -field on id input (default behavior)
     5022            let $form = this.$el;
     5023            if ( $form.hasClass( 'forminator-grouped-fields' ) ) {
     5024                $form = $form.closest( 'form.forminator-ui' );
     5025            }
     5026            var $form_id = $form.data( 'form-id' ),
     5027                $uid     = $form.data( 'uid' ),
     5028                $element = $form.find('#forminator-form-' + $form_id + '__field--' + element_id + '_' + $uid );
     5029            if ( $element.length === 0 ) {
     5030                var $element = $form.find('#' + element_id + '-field' );
     5031                if ($element.length === 0) {
     5032                    //find element by its on name (for radio on singlevalue)
     5033                    $element = $form.find('input[name=' + element_id + ']');
     5034                    if ($element.length === 0) {
     5035                        // for text area that have uniqid, so we check its name instead
     5036                        $element = $form.find('textarea[name=' + element_id + ']');
     5037                        if ($element.length === 0) {
     5038                            //find element by its on name[] (for checkbox on multivalue)
     5039                            $element = $form.find('input[name="' + element_id + '[]"]');
     5040                            if ($element.length === 0) {
     5041                                //find element by select name
     5042                                $element = this.$el.find('select[name="' + element_id + '"]');
     5043                                if ($element.length === 0) {
     5044                                    //find element by direct id (for name field mostly)
     5045                                    //will work for all field with element_id-[somestring]
     5046                                    $element = $form.find('#' + element_id);
     5047                                }
     5048                            }
     5049                        }
     5050                    }
     5051                }
     5052            }
     5053
     5054            return $element;
     5055        },
     5056
     5057        attachEventToTriggeringFields: function () {
     5058            var self = this;
     5059            for (var i = 0; i < this.calculationFields.length; i++) {
     5060                var calcField = this.calculationFields[i];
     5061                this.findTriggerInputs(calcField);
     5062            }
     5063
     5064            if (this.triggerInputs.length > 0) {
     5065                var cFields = [];
     5066                for (var j = 0; j < this.triggerInputs.length; j++) {
     5067                    var $input = this.triggerInputs[j];
     5068                    var inputId = $input.attr('id');
     5069
     5070                    if (cFields.indexOf(inputId) < 0) {
     5071                        $input.on('change.forminatorFrontCalculate, blur', function () {
     5072                            var calcFields = $(this).data('calcFields');
     5073
     5074                            if (calcFields !== undefined && calcFields.length > 0) {
     5075                                for (var k = 0; k < calcFields.length; k++) {
     5076                                    var calcField = calcFields[k];
     5077
     5078                                    if(self.field_is_checkbox($(this)) || self.field_is_radio($(this))) {
     5079                                        self.recalculate(calcField);
     5080                                    } else {
     5081                                        self.memoizeDebounceRender(calcField);
     5082                                    }
     5083                                }
     5084                            }
     5085                        });
     5086
     5087                        cFields.push(inputId);
     5088                    }
     5089                }
     5090            }
     5091        },
     5092
     5093        recalculateAll: function () {
     5094            for (var i = 0; i < this.calculationFields.length; i++) {
     5095                this.recalculate(this.calculationFields[i]);
     5096            }
     5097        },
     5098
     5099        recalculate: function (calcField) {
     5100            var $input = calcField.$input;
     5101
     5102            this.hideErrorMessage($input);
     5103
     5104            var formula = this.maybeReplaceFieldOnFormula(calcField.formula);
     5105
     5106            var res     = 0;
     5107            var calc    = new window.forminatorCalculator(formula);
     5108
     5109            try {
     5110                res = calc.calculate();
     5111                if (!isFinite(res)) {
     5112                    throw ('Infinity calculation result.');
     5113                }
     5114            } catch (e) {
     5115                this.isError = true;
     5116                console.log(e);
     5117                // override error message
     5118                this.displayErrorMessage( $input, this.settings.generalMessages.calculation_error );
     5119                res = '0';
     5120            }
     5121            // Support cases like 1.005. Correct result is 1.01.
     5122            res = ( +( Math.round( res + `e+${calcField.precision}` )  + `e-${calcField.precision}` ) ).toFixed(calcField.precision);
     5123
     5124            const inputVal = $input.val();
     5125            var decimal_point = $input.data('decimal-point');
     5126            res = String(res).replace(".", decimal_point );
     5127            if (inputVal !== res) {
     5128                $input.val(res).trigger("change");
     5129            }
     5130        },
     5131
     5132        maybeReplaceCalculationGroups: function (formula) {
     5133            var pattern = new RegExp('\\{((?:calculation|number|slider|currency|radio|select|checkbox)-\\d+(?:-min|-max)?)-\\*\\}', 'g');
     5134            var matches;
     5135            while( matches = pattern.exec( formula ) ) {
     5136                var fullMatch = matches[0];
     5137                var selector  = matches[1];
     5138                var repeatedFields = this.$el.find( "[name='" + selector + "'], [name='" + selector + "\[\]'], [name^='" + selector + "-']" ).map(function() {
     5139                    const name = this.name.replace( '[]', '' );
     5140                    return '{' + name + '}';
     5141                }).get();
     5142
     5143                repeatedFields = $.unique(repeatedFields.sort());
     5144                repeatedFields = '(' + repeatedFields.join('+') + ')';
     5145
     5146                formula = formula.replace( fullMatch, repeatedFields );
     5147            }
     5148            return formula;
     5149        },
     5150
     5151        maybeReplaceFieldOnFormula: function (formula) {
     5152            formula = this.maybeReplaceCalculationGroups(formula);
     5153
     5154            var joinedFieldTypes      = this.settings.forminatorFields.join('|');
     5155            var incrementFieldPattern = "(" + joinedFieldTypes + ")-\\d+";
     5156            var pattern               = new RegExp('\\{(' + incrementFieldPattern + '(?:-min|-max)?)(\\-[A-Za-z-_]+)?(\\-[A-Za-z0-9-_]+)?\\}', 'g');
     5157            var parsedFormula         = formula;
     5158
     5159            var matches;
     5160            while (matches = pattern.exec(formula)) {
     5161                var fullMatch = matches[0];
     5162                var groupSuffix = matches[4] || '';
     5163                var inputName = matches[1] + groupSuffix;
     5164                var fieldType = matches[2];
     5165
     5166                var replace = fullMatch;
     5167
     5168                if (fullMatch === undefined || inputName === undefined || fieldType === undefined) {
     5169                    continue;
     5170                }
     5171
     5172                if(this.is_hidden(inputName)) {
     5173                    replace = 0;
     5174                    const $element = this.get_form_field(inputName);
     5175                    if ( 'zero' !== $element.data('hidden-behavior') ) {
     5176                        var quotedOperand = fullMatch.replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
     5177                        var regexp = new RegExp('([\\+\\-\\*\\/]?)[^\\+\\-\\*\\/\\(]*' + quotedOperand + '[^\\)\\+\\-\\*\\/]*([\\+\\-\\*\\/]?)');
     5178                        var mt = regexp.exec(parsedFormula);
     5179                        if (mt) {
     5180                            // if operand in multiplication or division set value = 1
     5181                            if (mt[1] === '*' || mt[1] === '/' || mt[2] === '*' || mt[2] === '/') {
     5182                                replace = 1;
     5183                            }
     5184                        }
     5185                    }
     5186                } else {
     5187                    if (fieldType === 'calculation') {
     5188                        var calcField = this.get_calculation_field(inputName);
     5189
     5190                        if (calcField) {
     5191                            this.memoizeDebounceRender( calcField );
     5192                        }
     5193                    }
     5194
     5195                    replace = this.get_field_value(inputName);
     5196                }
     5197
     5198                // bracketify
     5199                replace       = '(' + replace + ')';
     5200                parsedFormula = parsedFormula.replace(fullMatch, replace);
     5201            }
     5202
     5203            return parsedFormula;
     5204        },
     5205
     5206
     5207        get_calculation_field: function (element_id) {
     5208            for (var i = 0; i < this.calculationFields.length; i++) {
     5209                if(this.calculationFields[i].name === element_id) {
     5210                    return this.calculationFields[i];
     5211                }
     5212            }
     5213
     5214            return false;
     5215        },
     5216
     5217        is_hidden: function (element_id) {
     5218            var $element_id = this.get_form_field(element_id),
     5219                $column_field = $element_id.closest('.forminator-col'),
     5220                $row_field = $column_field.closest('.forminator-row')
     5221            ;
     5222
     5223            if( $row_field.hasClass("forminator-hidden-option") || $column_field.hasClass("forminator-hidden-option") ) {
     5224                return false;
     5225            }
     5226
     5227            if( $row_field.hasClass("forminator-hidden") || $column_field.hasClass("forminator-hidden") ) {
     5228                return true;
     5229            }
     5230
     5231            return false;
     5232        },
     5233
     5234        get_field_value: function (element_id) {
     5235            var $element    = this.get_form_field(element_id);
     5236            var value       = 0;
     5237            var calculation = 0;
     5238            var checked     = null;
     5239
     5240            if (this.field_is_radio($element)) {
     5241                checked = $element.filter(":checked");
     5242                if (checked.length) {
     5243                    calculation = checked.data('calculation');
     5244                    if (calculation !== undefined) {
     5245                        value = Number(calculation);
     5246                    }
     5247                }
     5248            } else if (this.field_is_checkbox($element)) {
     5249                $element.each(function () {
     5250                    if ($(this).is(':checked')) {
     5251                        calculation = $(this).data('calculation');
     5252                        if (calculation !== undefined) {
     5253                            value += Number(calculation);
     5254                        }
     5255                    }
     5256                });
     5257
     5258            } else if (this.field_is_select($element)) {
     5259                checked = $element.find("option").filter(':selected');
     5260                if (checked.length) {
     5261                    calculation = checked.data('calculation');
     5262                    if (calculation !== undefined) {
     5263                        value = Number(calculation);
     5264                    }
     5265                }
     5266            } else if ( this.field_has_inputMask( $element ) ) {
     5267                value = parseFloat( $element.inputmask('unmaskedvalue').replace(',','.') );
     5268            } else if ( $element.length ) {
     5269                var number = $element.val();
     5270                value = parseFloat( number.replace(',','.') );
     5271            }
     5272
     5273            return isNaN(value) ? 0 : value;
     5274        },
     5275
     5276        field_has_inputMask: function ( $element ) {
     5277            var hasMask = false;
     5278
     5279            $element.each(function () {
     5280                if ( undefined !== $( this ).attr( 'data-inputmask' ) ) {
     5281                    hasMask = true;
     5282                    //break
     5283                    return false;
     5284                }
     5285            });
     5286
     5287            return hasMask;
     5288        },
     5289
     5290        field_is_radio: function ($element) {
     5291            var is_radio = false;
     5292            $element.each(function () {
     5293                if ($(this).attr('type') === 'radio') {
     5294                    is_radio = true;
     5295                    //break
     5296                    return false;
     5297                }
     5298            });
     5299
     5300            return is_radio;
     5301        },
     5302
     5303        field_is_checkbox: function ($element) {
     5304            var is_checkbox = false;
     5305            $element.each(function () {
     5306                if ($(this).attr('type') === 'checkbox') {
     5307                    is_checkbox = true;
     5308                    //break
     5309                    return false;
     5310                }
     5311            });
     5312
     5313            return is_checkbox;
     5314        },
     5315
     5316        field_is_select: function ($element) {
     5317            return $element.is('select');
     5318        },
     5319
     5320        displayErrorMessage: function ($element, errorMessage) {
     5321            var $field_holder = $element.closest('.forminator-field--inner');
     5322
     5323            if ($field_holder.length === 0) {
     5324                $field_holder = $element.closest('.forminator-field');
     5325            }
     5326
     5327            var $error_holder = $field_holder.find('.forminator-error-message');
     5328            var $error_id = $element.attr('id') + '-error';
     5329            var $element_aria_describedby = $element.attr('aria-describedby');
     5330
     5331            if ($element_aria_describedby) {
     5332                var ids = $element_aria_describedby.split(' ');
     5333                var errorIdExists = ids.includes($error_id);
     5334                if (!errorIdExists) {
     5335                    ids.push($error_id);
     5336                }
     5337                var updatedAriaDescribedby = ids.join(' ');
     5338                $element.attr('aria-describedby', updatedAriaDescribedby);
     5339            } else {
     5340                $element.attr('aria-describedby', $error_id);
     5341            }
     5342
     5343            if ($error_holder.length === 0) {
     5344                $field_holder.append('<span class="forminator-error-message" id="' + $error_id + '"></span>');
     5345                $error_holder = $field_holder.find('.forminator-error-message');
     5346            }
     5347
     5348            $element.attr('aria-invalid', 'true');
     5349            $error_holder.html(errorMessage);
     5350            $field_holder.addClass('forminator-has_error');
     5351        },
     5352
     5353        hideErrorMessage: function ($element) {
     5354            var $field_holder = $element.closest('.forminator-field--inner');
     5355
     5356            if ($field_holder.length === 0) {
     5357                $field_holder = $element.closest('.forminator-field');
     5358            }
     5359
     5360            var $error_holder = $field_holder.find('.forminator-error-message');
     5361            var $error_id = $element.attr('id') + '-error';
     5362            var $element_aria_describedby = $element.attr('aria-describedby');
     5363
     5364            if ($element_aria_describedby) {
     5365                var ids = $element_aria_describedby.split(' ');
     5366                ids = ids.filter(function (id) {
     5367                    return id !== $error_id;
     5368                });
     5369                var updatedAriaDescribedby = ids.join(' ');
     5370                $element.attr('aria-describedby', updatedAriaDescribedby);
     5371            } else {
     5372                $element.removeAttr('aria-describedby');
     5373            }
     5374
     5375            $element.removeAttr('aria-invalid');
     5376            $error_holder.remove();
     5377            $field_holder.removeClass('forminator-has_error');
     5378        },
     5379
     5380    });
     5381
     5382    // A really lightweight plugin wrapper around the constructor,
     5383    // preventing against multiple instantiations
     5384    $.fn[pluginName] = function (options) {
     5385        return this.each(function () {
     5386            if (!$.data(this, pluginName)) {
     5387                $.data(this, pluginName, new ForminatorFrontCalculate(this, options));
     5388            }
     5389        });
     5390    };
     5391
     5392})(jQuery, window, document);
     5393
     5394// the semi-colon before function invocation is a safety net against concatenated
     5395// scripts and/or other plugins which may not be closed properly.
     5396;// noinspection JSUnusedLocalSymbols
     5397(function ($, window, document, undefined) {
     5398
     5399    "use strict";
     5400
     5401    // undefined is used here as the undefined global variable in ECMAScript 3 is
     5402    // mutable (ie. it can be changed by someone else). undefined isn't really being
     5403    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     5404    // can no longer be modified.
     5405
     5406    // window and document are passed through as local variables rather than global
     5407    // as this (slightly) quickens the resolution process and can be more efficiently
     5408    // minified (especially when both are regularly referenced in your plugin).
     5409
     5410    // Create the defaults once
     5411    var pluginName = "forminatorFrontMergeTags",
     5412        defaults   = {
     5413            print_value: false,
     5414            forminatorFields: [],
     5415        };
     5416
     5417    // The actual plugin constructor
     5418    function forminatorFrontMergeTags(element, options) {
     5419        this.element = element;
     5420        this.$el     = $(this.element);
     5421
     5422        // jQuery has an extend method which merges the contents of two or
     5423        // more objects, storing the result in the first object. The first object
     5424        // is generally empty as we don't want to alter the default options for
     5425        // future instances of the plugin
     5426        this.settings          = $.extend({}, defaults, options);
     5427        this._defaults         = defaults;
     5428        this._name             = pluginName;
     5429        ForminatorFront.MergeTags = ForminatorFront.MergeTags || [];
     5430        this.init();
     5431    }
     5432
     5433    // Avoid Plugin.prototype conflicts
     5434    $.extend(forminatorFrontMergeTags.prototype, {
     5435        init: function () {
     5436            var self = this;
     5437            var fields = this.$el.find('.forminator-merge-tags');
     5438            const formId = this.getFormId();
     5439
     5440            ForminatorFront.MergeTags[ formId ] = ForminatorFront.MergeTags[ formId ] || [];
     5441
     5442            if (fields.length > 0) {
     5443                fields.each(function () {
     5444                    let html = $(this).html(),
     5445                        fieldId = $(this).data('field');
     5446
     5447                    if ( self.$el.hasClass( 'forminator-grouped-fields' ) ) {
     5448                        // Get origin HTML during cloningGroup fields.
     5449                        const suffix = self.$el.data( 'suffix' );
     5450                        if ( ForminatorFront.MergeTags[ formId ][ fieldId ] ) {
     5451                            html = ForminatorFront.MergeTags[ formId ][ fieldId ]['value'];
     5452                            // get Fields in the current Group.
     5453                            const groupFields = self.$el.find( '[name]' ).map(function() {
     5454                                return this.name;
     5455                            }).get();
     5456                            $.each( groupFields, function( index, item ) {
     5457                                var fieldWithoutSuffix = item.replace( '-' + suffix, '' );
     5458                                if ( fieldWithoutSuffix === item ) {
     5459                                    return; // continue.
     5460                                }
     5461                                const regexp = new RegExp( `{${fieldWithoutSuffix}}`, 'g' );
     5462                                html = html.replace( regexp, '{' + item + '}' );
     5463                            });
     5464                        }
     5465
     5466                        fieldId += '-' + suffix;
     5467                    }
     5468
     5469                    ForminatorFront.MergeTags[ formId ][ fieldId ] = {
     5470                        $input: $(this),
     5471                        value: html,
     5472                    };
     5473                });
     5474            }
     5475
     5476            this.replaceAll();
     5477            this.attachEvents();
     5478        },
     5479
     5480        getFormId: function () {
     5481            let formId = '';
     5482            if ( this.$el.hasClass( 'forminator-grouped-fields' ) ) {
     5483                formId = this.$el.closest( 'form.forminator-ui' ).data( 'form-id' );
     5484            } else {
     5485                formId = this.$el.data( 'form-id' );
     5486            }
     5487
     5488            return formId;
     5489        },
     5490
     5491        attachEvents: function () {
     5492            var self = this;
     5493
     5494            this.$el.find(
     5495                '.forminator-textarea, input.forminator-input, .forminator-checkbox, .forminator-radio, .forminator-input-file, select.forminator-select2, .forminator-multiselect input'
     5496                + ', input.forminator-slider-hidden, input.forminator-slider-hidden-min, input.forminator-slider-hidden-max'
     5497            ).each(function () {
     5498                $(this).on('change', function () {
     5499                    // Give jquery sometime to apply changes
     5500                    setTimeout( function() {
     5501                       self.replaceAll();
     5502               }, 300 );
     5503                });
     5504            });
     5505        },
     5506
     5507        replaceAll: function () {
     5508            const self = this,
     5509                    formId = this.getFormId(),
     5510                    formFields = ForminatorFront.MergeTags[ formId ];
     5511
     5512            for ( const key in formFields ) {
     5513                const formField = formFields[key];
     5514                self.replace( formField );
     5515            }
     5516        },
     5517
     5518        replace: function ( field ) {
     5519            var $input = field.$input;
     5520            var res = this.maybeReplaceValue(field.value);
     5521
     5522            $input.html(res);
     5523        },
     5524
     5525        maybeReplaceValue: function (value) {
     5526            var joinedFieldTypes      = this.settings.forminatorFields.join('|');
     5527            var incrementFieldPattern = "(" + joinedFieldTypes + ")-\\d+";
     5528            var pattern               = new RegExp('\\{(' + incrementFieldPattern + ')(\\-[0-9A-Za-z-_]+)?\\}', 'g');
     5529            var parsedValue           = value;
     5530
     5531            var matches;
     5532            while (matches = pattern.exec(value)) {
     5533                var fullMatch = matches[0];
     5534                var inputName = fullMatch.replace('{', '').replace('}', '');
     5535                var fieldType = matches[2];
     5536
     5537                var replace = fullMatch;
     5538
     5539                if (fullMatch === undefined || inputName === undefined || fieldType === undefined) {
     5540                    continue;
     5541                }
     5542
     5543                replace = this.get_field_value(inputName);
     5544
     5545                parsedValue = parsedValue.replace(fullMatch, replace);
     5546            }
     5547
     5548            return parsedValue;
     5549        },
     5550
     5551        // taken from forminatorFrontCondition
     5552        get_form_field: function (element_id) {
     5553            let $form = this.$el;
     5554            if ( $form.hasClass( 'forminator-grouped-fields' ) ) {
     5555                $form = $form.closest( 'form.forminator-ui' );
     5556            }
     5557            //find element by suffix -field on id input (default behavior)
     5558            var $element = $form.find('#' + element_id + '-field');
     5559            if ($element.length === 0) {
     5560                //find element by its on name
     5561                $element = $form.find('[name=' + element_id + ']');
     5562                if ($element.length === 0) {
     5563                    //find element by its on name[] (for checkbox on multivalue)
     5564                    $element = $form.find('input[name="' + element_id + '[]"]');
     5565                    if ($element.length === 0) {
     5566                        //find element by direct id (for name field mostly)
     5567                        //will work for all field with element_id-[somestring]
     5568                        $element = $form.find('#' + element_id);
     5569                    }
     5570                }
     5571            }
     5572
     5573            return $element;
     5574        },
     5575
     5576        is_calculation: function (element_id) {
     5577            var $element    = this.get_form_field(element_id);
     5578
     5579            if ( $element.hasClass("forminator-calculation") ) {
     5580                return true;
     5581            }
     5582
     5583            return false;
     5584        },
     5585
     5586        get_field_value: function (element_id) {
     5587            var $element    = this.get_form_field(element_id),
     5588                self        = this,
     5589                value       = '',
     5590                checked     = null;
     5591
     5592            if ( this.is_hidden( element_id ) && ! this.is_calculation( element_id ) ) {
     5593            return '';
     5594            }
     5595
     5596            if ( this.is_calculation( element_id ) ) {
     5597                var $element_id = this.get_form_field(element_id),
     5598                    $column_field = $element_id.closest('.forminator-col'),
     5599                    $row_field = $column_field.closest('.forminator-row')
     5600                ;
     5601
     5602                if ( ! $row_field.hasClass("forminator-hidden-option") && this.is_hidden( element_id ) ) {
     5603                    return '';
     5604                }
     5605            }
     5606
     5607            if (this.field_is_radio($element)) {
     5608                checked = $element.filter(":checked");
     5609
     5610                if (checked.length) {
     5611                    if ( this.settings.print_value ) {
     5612                        value = checked.val();
     5613                    } else {
     5614                        value = 0 === checked.siblings( '.forminator-radio-label' ).length
     5615                                ? checked.siblings( '.forminator-screen-reader-only' ).text()
     5616                                : checked.siblings( '.forminator-radio-label' ).text();
     5617                    }
     5618                }
     5619            } else if (this.field_is_checkbox($element)) {
     5620                $element.each(function () {
     5621                    if ($(this).is(':checked')) {
     5622                        if(value !== "") {
     5623                            value += ', ';
     5624                        }
     5625
     5626                        var multiselect = !! $(this).closest('.forminator-multiselect').length;
     5627
     5628                        if ( self.settings.print_value ) {
     5629                            value += $(this).val();
     5630                        } else if ( multiselect ) {
     5631                            value += $(this).closest('label').text();
     5632                        } else {
     5633                            value += 0 === $(this).siblings( '.forminator-checkbox-label' ).length
     5634                                     ? $(this).siblings( '.forminator-screen-reader-only' ).text()
     5635                                     : $(this).siblings( '.forminator-checkbox-label' ).text();
     5636                        }
     5637                    }
     5638                });
     5639
     5640            } else if (this.field_is_select($element)) {
     5641                checked = $element.find("option").filter(':selected');
     5642                if (checked.length) {
     5643                    if ( this.settings.print_value ) {
     5644                        value = checked.val();
     5645                    } else {
     5646                        value = checked.text();
     5647                    }
     5648                }
     5649            } else if (this.field_is_upload($element)) {
     5650                value = $element.val().split('\\').pop();
     5651            } else if (this.field_has_inputMask($element)) {
     5652                $element.inputmask({'autoUnmask' : false});
     5653                value = $element.val();
     5654                $element.inputmask({'autoUnmask' : true});
     5655            } else {
     5656                value = $element.val();
     5657            }
     5658
     5659            return value;
     5660        },
     5661
     5662        field_has_inputMask: function ( $element ) {
     5663            var hasMask = false;
     5664
     5665            $element.each(function () {
     5666                if ( undefined !== $( this ).attr( 'data-inputmask' ) ) {
     5667                    hasMask = true;
     5668                    //break
     5669                    return false;
     5670                }
     5671            });
     5672
     5673            return hasMask;
     5674        },
     5675
     5676        field_is_radio: function ($element) {
     5677            var is_radio = false;
     5678            $element.each(function () {
     5679                if ($(this).attr('type') === 'radio') {
     5680                    is_radio = true;
     5681                    //break
     5682                    return false;
     5683                }
     5684            });
     5685
     5686            return is_radio;
     5687        },
     5688
     5689        field_is_checkbox: function ($element) {
     5690            var is_checkbox = false;
     5691            $element.each(function () {
     5692                if ($(this).attr('type') === 'checkbox') {
     5693                    is_checkbox = true;
     5694                    //break
     5695                    return false;
     5696                }
     5697            });
     5698
     5699            return is_checkbox;
     5700        },
     5701
     5702        field_is_upload: function ($element) {
     5703            if ($element.attr('type') === 'file') {
     5704                return true;
     5705            }
     5706
     5707            return false;
     5708        },
     5709
     5710        field_is_select: function ($element) {
     5711            return $element.is('select');
     5712        },
     5713
     5714        // modified from front.condition
     5715        is_hidden: function (element_id) {
     5716            var $element_id = this.get_form_field(element_id),
     5717                $column_field = $element_id.closest('.forminator-col'),
     5718                $row_field = $column_field.closest('.forminator-row')
     5719            ;
     5720
     5721            if ( $row_field.hasClass("forminator-hidden-option") || $row_field.hasClass("forminator-hidden") ) {
     5722                return true;
     5723            }
     5724
     5725            if( $column_field.hasClass("forminator-hidden") ) {
     5726                return true;
     5727            }
     5728
     5729            return false;
     5730        },
     5731    });
     5732
     5733    // A really lightweight plugin wrapper around the constructor,
     5734    // preventing against multiple instantiations
     5735    $.fn[pluginName] = function (options) {
     5736        return this.each(function () {
     5737            if (!$.data(this, pluginName)) {
     5738                $.data(this, pluginName, new forminatorFrontMergeTags(this, options));
     5739            }
     5740        });
     5741    };
     5742
     5743})(jQuery, window, document);
     5744
     5745// the semi-colon before function invocation is a safety net against concatenated
     5746// scripts and/or other plugins which may not be closed properly.
     5747;// noinspection JSUnusedLocalSymbols
     5748(function ($, window, document, undefined) {
     5749
     5750    "use strict";
     5751
     5752    // Polyfill
     5753    if (!Object.assign) {
     5754        Object.defineProperty(Object, 'assign', {
     5755            enumerable: false,
     5756            configurable: true,
     5757            writable: true,
     5758            value: function(target, firstSource) {
     5759                'use strict';
     5760                if (target === undefined || target === null) {
     5761                    throw new TypeError('Cannot convert first argument to object');
     5762                }
     5763
     5764                var to = Object(target);
     5765                for (var i = 1; i < arguments.length; i++) {
     5766                    var nextSource = arguments[i];
     5767                    if (nextSource === undefined || nextSource === null) {
     5768                        continue;
     5769                    }
     5770
     5771                    var keysArray = Object.keys(Object(nextSource));
     5772                    for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
     5773                        var nextKey = keysArray[nextIndex];
     5774                        var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
     5775                        if (desc !== undefined && desc.enumerable) {
     5776                            to[nextKey] = nextSource[nextKey];
     5777                        }
     5778                    }
     5779                }
     5780                return to;
     5781            }
     5782        });
     5783    }
     5784
     5785    // undefined is used here as the undefined global variable in ECMAScript 3 is
     5786    // mutable (ie. it can be changed by someone else). undefined isn't really being
     5787    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     5788    // can no longer be modified.
     5789
     5790    // window and document are passed through as local variables rather than global
     5791    // as this (slightly) quickens the resolution process and can be more efficiently
     5792    // minified (especially when both are regularly referenced in your plugin).
     5793
     5794    // Create the defaults once
     5795    var pluginName = "forminatorFrontPayment",
     5796        defaults   = {
     5797            type: 'stripe',
     5798            paymentEl: null,
     5799            paymentRequireSsl: false,
     5800            generalMessages: {},
     5801        };
     5802
     5803    // The actual plugin constructor
     5804    function ForminatorFrontPayment(element, options) {
     5805        this.element = element;
     5806        this.$el     = $(this.element);
     5807
     5808        // jQuery has an extend method which merges the contents of two or
     5809        // more objects, storing the result in the first object. The first object
     5810        // is generally empty as we don't want to alter the default options for
     5811        // future instances of the plugin
     5812        this.settings              = $.extend({}, defaults, options);
     5813        this._defaults             = defaults;
     5814        this._name                 = pluginName;
     5815        this._stripeData           = null;
     5816        this._stripe               = null;
     5817        this._cardElement          = null;
     5818        this._stripeToken          = null;
     5819        this._beforeSubmitCallback = null;
     5820        this._form                 = null;
     5821        this._paymentIntent        = null;
     5822        this.init();
     5823    }
     5824
     5825    // Avoid Plugin.prototype conflicts
     5826    $.extend(ForminatorFrontPayment.prototype, {
     5827        init: function () {
     5828            if (!this.settings.paymentEl || typeof this.settings.paymentEl.data() === 'undefined') {
     5829                return;
     5830            }
     5831
     5832            var self         = this;
     5833            this._stripeData = this.settings.paymentEl.data();
     5834
     5835            if ( false === this.mountCardField() ) {
     5836                return;
     5837            }
     5838
     5839            $(this.element).on('payment.before.submit.forminator', function (e, formData, callback) {
     5840                self._form = self.getForm(e);
     5841                self._beforeSubmitCallback = callback;
     5842                self.validateStripe(e, formData);
     5843            });
     5844
     5845            this.$el.on("forminator:form:submit:stripe:3dsecurity", function(e, secret, subscription) {
     5846                self.validate3d(e, secret, subscription);
     5847            });
     5848
     5849            // Listen for fields change to update ZIP mapping
     5850            this.$el.find(
     5851                'input.forminator-input, .forminator-checkbox, .forminator-radio, select.forminator-select2'
     5852            ).each(function () {
     5853                $(this).on('change', function (e) {
     5854                    self.mapZip(e);
     5855                });
     5856            });
     5857        },
     5858
     5859        validate3d: function( e, secret, subscription ) {
     5860            var self = this;
     5861
     5862            if ( subscription ) {
     5863                this._stripe.confirmCardPayment(secret, {
     5864                    payment_method: {
     5865                        card: self._cardElement,
     5866                        ...self.getBillingData(),
     5867                    },
     5868                })
     5869                .then(function(result) {
     5870                    self.$el.find('#forminator-stripe-subscriptionid').val( subscription );
     5871
     5872                    if (self._beforeSubmitCallback) {
     5873                        self._beforeSubmitCallback.call();
     5874                    }
     5875                });
     5876            } else {
     5877                this._stripe.retrievePaymentIntent(
     5878                    secret
     5879                ).then(function(result) {
     5880                    if ( result.paymentIntent.status === 'requires_action' ||  result.paymentIntent.status === 'requires_source_action' ) {
     5881                        self._stripe.handleCardAction(
     5882                            secret
     5883                        ).then(function(result) {
     5884                            if (self._beforeSubmitCallback) {
     5885                                self._beforeSubmitCallback.call();
     5886                            }
     5887                        });
     5888                    }
     5889                });
     5890            }
     5891        },
     5892
     5893        validateStripe: function(e, formData) {
     5894            var self = this;
     5895
     5896            this._stripe.createToken(this._cardElement).then(function (result) {
     5897                if (result.error) {
     5898                    self.showCardError(result.error.message, true);
     5899                    self.$el.find( 'button' ).removeAttr( 'disabled' );
     5900                } else {
     5901                    self.hideCardError();
     5902
     5903                    self._stripe.createPaymentMethod('card', self._cardElement, self.getBillingData()).then(function (result) {
     5904                        var paymentMethod = self.getObjectValue(result, 'paymentMethod');
     5905
     5906                        self._stripeData['paymentMethod'] = self.getObjectValue(paymentMethod, 'id');
     5907                        self.updateAmount(e, formData, result);
     5908                    });
     5909                }
     5910            });
     5911        },
     5912
     5913        isValid: function(focus) {
     5914            var self = this;
     5915
     5916            this._stripe.createToken(this._cardElement).then(function (result) {
     5917                if (result.error) {
     5918                    self.showCardError(result.error.message, focus);
     5919                } else {
     5920                    self.hideCardError();
     5921                }
     5922            });
     5923        },
     5924
     5925        getForm: function(e) {
     5926            var $form = $( e.target );
     5927
     5928            if(!$form.hasClass('forminator-custom-form')) {
     5929                $form = $form.closest('form.forminator-custom-form');
     5930            }
     5931
     5932            return $form;
     5933        },
     5934
     5935        updateAmount: function(e, formData, result) {
     5936            e.preventDefault();
     5937            var self = this;
     5938            var updateFormData = formData;
     5939            var paymentMethod = this.getObjectValue(result, 'paymentMethod');
     5940
     5941            //Method set() doesn't work in IE11
     5942            updateFormData.append( 'action', 'forminator_update_payment_amount' );
     5943            updateFormData.append( 'paymentid', this.getStripeData('paymentid') );
     5944            updateFormData.append( 'payment_method', this.getObjectValue(paymentMethod, 'id') );
     5945
     5946            var receipt = this.getStripeData('receipt');
     5947            var receiptEmail = this.getStripeData('receiptEmail');
     5948            var receiptObject = {};
     5949
     5950            if( receipt && receiptEmail ) {
     5951                var emailValue = this.get_field_value(receiptEmail) || '';
     5952
     5953                updateFormData.append( 'receipt_email', emailValue );
     5954            }
     5955
     5956            $.ajax({
     5957                type: 'POST',
     5958                url: window.ForminatorFront.ajaxUrl,
     5959                data: updateFormData,
     5960                cache: false,
     5961                contentType: false,
     5962                processData: false,
     5963                beforeSend: function () {
     5964                    if( typeof self.settings.has_loader !== "undefined" && self.settings.has_loader ) {
     5965                        // Disable form fields
     5966                        self._form.addClass('forminator-fields-disabled');
     5967
     5968                        var $target_message = self._form.find('.forminator-response-message');
     5969
     5970                        $target_message.html('<p>' + self.settings.loader_label + '</p>');
     5971
     5972                        self.focus_to_element($target_message);
     5973
     5974                        $target_message.removeAttr("aria-hidden")
     5975                            .prop("tabindex", "-1")
     5976                            .removeClass('forminator-success forminator-error')
     5977                            .addClass('forminator-loading forminator-show');
     5978                    }
     5979
     5980                    self._form.find('button').attr('disabled', true);
     5981                },
     5982                success: function (data) {
     5983                    if (data.success === true) {
     5984                        // Store payment id
     5985                        if (typeof data.data !== 'undefined' && typeof data.data.paymentid !== 'undefined') {
     5986                            self.$el.find('#forminator-stripe-paymentid').val(data.data.paymentid);
     5987                            self.$el.find('#forminator-stripe-paymentmethod').val(self._stripeData['paymentMethod']);
     5988                            self._stripeData['paymentid'] = data.data.paymentid;
     5989                            self._stripeData['secret'] = data.data.paymentsecret;
     5990
     5991                            self.handleCardPayment(data, e, formData);
     5992                        } else {
     5993                            self.show_error('Invalid Payment Intent ID');
     5994                        }
     5995                    } else {
     5996                        self.show_error(data.data.message);
     5997
     5998                        if(data.data.errors.length) {
     5999                            self.show_messages(data.data.errors);
     6000                        }
     6001
     6002                        var $captcha_field = self._form.find('.forminator-g-recaptcha');
     6003
     6004                        if ($captcha_field.length) {
     6005                            $captcha_field = $($captcha_field.get(0));
     6006
     6007                            var recaptcha_widget = $captcha_field.data('forminator-recapchta-widget'),
     6008                                recaptcha_size = $captcha_field.data('size');
     6009
     6010                            if (recaptcha_size === 'invisible') {
     6011                                window.grecaptcha.reset(recaptcha_widget);
     6012                            }
     6013                        }
     6014                    }
     6015                },
     6016                error: function (err) {
     6017                    var $message = err.status === 400 ? window.ForminatorFront.cform.upload_error : window.ForminatorFront.cform.error;
     6018
     6019                    self.show_error($message);
     6020                }
     6021            })
     6022        },
     6023
     6024        show_error: function(message) {
     6025            var $target_message = this._form.find('.forminator-response-message');
     6026
     6027            this._form.find('button').removeAttr('disabled');
     6028
     6029            $target_message.removeAttr("aria-hidden")
     6030                .prop("tabindex", "-1")
     6031                .removeClass('forminator-loading')
     6032                .addClass('forminator-error forminator-show');
     6033
     6034            $target_message.html('<p>' + message + '</p>');
     6035
     6036            this.focus_to_element($target_message);
     6037
     6038            this.enable_form();
     6039        },
     6040
     6041        enable_form: function() {
     6042            if( typeof this.settings.has_loader !== "undefined" && this.settings.has_loader ) {
     6043                var $target_message = this._form.find('.forminator-response-message');
     6044
     6045                // Enable form fields
     6046                this._form.removeClass('forminator-fields-disabled');
     6047
     6048                $target_message.removeClass('forminator-loading');
     6049            }
     6050        },
     6051
     6052        mapZip: function (e) {
     6053            var verifyZip = this.getStripeData('veifyZip');
     6054            var zipField = this.getStripeData('zipField');
     6055            var changedField = $(e.currentTarget).attr('name');
     6056
     6057            // Verify ZIP is enabled, mapped field is not empty and changed field is the mapped field, proceed
     6058            if (verifyZip && zipField !== "" && changedField === zipField) {
     6059                if (e.originalEvent !== undefined) {
     6060                    // Get field
     6061                    var value = this.get_field_value(zipField);
     6062
     6063                    // Update card element
     6064                    this._cardElement.update({
     6065                        value: {
     6066                            postalCode: value
     6067                        }
     6068                    });
     6069                }
     6070            }
     6071        },
     6072
     6073        focus_to_element: function ($element) {
     6074            // force show in case its hidden of fadeOut
     6075            $element.show();
     6076            $('html,body').animate({scrollTop: ($element.offset().top - ($(window).height() - $element.outerHeight(true)) / 2)}, 500, function () {
     6077                if (!$element.attr("tabindex")) {
     6078                    $element.attr("tabindex", -1);
     6079                }
     6080
     6081                $element.focus();
     6082            });
     6083        },
     6084
     6085        show_messages: function (errors) {
     6086            var self = this,
     6087                forminatorFrontCondition = self.$el.data('forminatorFrontCondition');
     6088            if (typeof forminatorFrontCondition !== 'undefined') {
     6089                // clear all validation message before show new one
     6090                this.$el.find('.forminator-error-message').remove();
     6091                var i = 0;
     6092                errors.forEach(function (value) {
     6093                    var element_id = Object.keys(value),
     6094                        message = Object.values(value),
     6095                        element = forminatorFrontCondition.get_form_field(element_id);
     6096                    if (element.length) {
     6097                        if (i === 0) {
     6098                            // focus on first error
     6099                            self.$el.trigger('forminator.front.pagination.focus.input',[element]);
     6100                            self.focus_to_element(element);
     6101                        }
     6102
     6103                        if ($(element).hasClass('forminator-input-time')) {
     6104                            var $time_field_holder = $(element).closest('.forminator-field:not(.forminator-field--inner)'),
     6105                                $time_error_holder = $time_field_holder.children('.forminator-error-message');
     6106
     6107                            if ($time_error_holder.length === 0) {
     6108                                $time_field_holder.append('<span class="forminator-error-message" aria-hidden="true"></span>');
     6109                                $time_error_holder = $time_field_holder.children('.forminator-error-message');
     6110                            }
     6111                            $time_error_holder.html(message);
     6112                        }
     6113
     6114                        var $field_holder = $(element).closest('.forminator-field--inner');
     6115
     6116                        if ($field_holder.length === 0) {
     6117                            $field_holder = $(element).closest('.forminator-field');
     6118                            if ($field_holder.length === 0) {
     6119                                // handling postdata field
     6120                                $field_holder = $(element).find('.forminator-field');
     6121                                if ($field_holder.length > 1) {
     6122                                    $field_holder = $field_holder.first();
     6123                                }
     6124                            }
     6125                        }
     6126
     6127                        var $error_holder = $field_holder.find('.forminator-error-message');
     6128
     6129                        if ($error_holder.length === 0) {
     6130                            $field_holder.append('<span class="forminator-error-message" aria-hidden="true"></span>');
     6131                            $error_holder = $field_holder.find('.forminator-error-message');
     6132                        }
     6133                        $(element).attr('aria-invalid', 'true');
     6134                        $error_holder.html(message);
     6135                        $field_holder.addClass('forminator-has_error');
     6136                        i++;
     6137                    }
     6138                });
     6139            }
     6140
     6141            return this;
     6142        },
     6143
     6144        getBillingData: function (formData) {
     6145            var billing = this.getStripeData('billing');
     6146
     6147            // If billing is disabled, return
     6148            if (!billing) {
     6149                return {}
     6150            };
     6151
     6152            // Get billing fields
     6153            var billingName = this.getStripeData('billingName');
     6154            var billingEmail = this.getStripeData('billingEmail');
     6155            var billingAddress = this.getStripeData('billingAddress');
     6156
     6157            // Create billing object
     6158            var billingObject = {
     6159                address: {}
     6160            }
     6161
     6162            if( billingName ) {
     6163                var nameField = this.get_field_value(billingName);
     6164
     6165                // Check if Name field is multiple
     6166                if (!nameField) {
     6167                    var fName = this.get_field_value(billingName + '-first-name') || '';
     6168                    var lName = this.get_field_value(billingName + '-last-name') || '';
     6169
     6170                    nameField = fName + ' ' + lName;
     6171                }
     6172
     6173                // Check if Name field is empty in the end, if not assign to the object
     6174                if (nameField) {
     6175                    billingObject.name = nameField;
     6176                }
     6177            }
     6178
     6179            // Map email field
     6180            if(billingEmail) {
     6181                var billingEmailValue = this.get_field_value(billingEmail) || '';
     6182                if (billingEmailValue) {
     6183                    billingObject.email = billingEmailValue;
     6184                }
     6185            }
     6186
     6187            // Map address line 1 field
     6188            var addressLine1 = this.get_field_value(billingAddress + '-street_address') || '';
     6189            if (addressLine1) {
     6190                billingObject.address.line1 = addressLine1;
     6191            }
     6192
     6193            // Map address line 2 field
     6194            var addressLine2 = this.get_field_value(billingAddress + '-address_line') || '';
     6195            if (addressLine2) {
     6196                billingObject.address.line2 = addressLine2;
     6197            }
     6198
     6199            // Map address city field
     6200            var addressCity = this.get_field_value(billingAddress + '-city') || '';
     6201            if (addressCity) {
     6202                billingObject.address.city = addressCity;
     6203            }
     6204
     6205            // Map address state field
     6206            var addressState = this.get_field_value(billingAddress + '-state') || '';
     6207            if (addressState) {
     6208                billingObject.address.state = addressState;
     6209            }
     6210
     6211            // Map address country field
     6212            var countryField = this.get_form_field(billingAddress + '-country');
     6213            var addressCountry = countryField.find(':selected').data('country-code');
     6214
     6215            if (addressCountry) {
     6216                billingObject.address.country = addressCountry;
     6217            }
     6218
     6219            // Map address country field
     6220            var addressZip = this.get_field_value(billingAddress + '-zip') || '';
     6221                if (addressZip) {
     6222                billingObject.address.postal_code = addressZip;
     6223            }
     6224
     6225            return {
     6226                billing_details: billingObject
     6227            }
     6228        },
     6229
     6230        handleCardPayment: function (data, e, formData) {
     6231            var self = this,
     6232                secret = data.data.paymentsecret || false,
     6233                input = $( '.forminator-number--field, .forminator-currency, .forminator-calculation' );
     6234
     6235            if ( input.inputmask ) {
     6236                input.inputmask('remove');
     6237            }
     6238
     6239            if (self._beforeSubmitCallback) {
     6240                self._beforeSubmitCallback.call();
     6241            }
     6242        },
     6243
     6244        mountCardField: function () {
     6245            var key = this.getStripeData('key');
     6246            var cardIcon = this.getStripeData('cardIcon');
     6247            var verifyZip = this.getStripeData('veifyZip');
     6248            var zipField = this.getStripeData('zipField');
     6249            var fieldId = this.getStripeData('fieldId');
     6250
     6251            if ( null === key ) {
     6252                return false;
     6253            }
     6254
     6255            // Init Stripe
     6256            this._stripe = Stripe( key, {
     6257                locale: this.getStripeData('language')
     6258            } );
     6259
     6260            // Create empty ZIP object
     6261            var zipObject = {}
     6262
     6263            if (!verifyZip) {
     6264                // If verify ZIP is disabled, disable ZIP
     6265                zipObject.hidePostalCode = true;
     6266            } else {
     6267                // Set empty post code, later will be updated when field is changed
     6268                zipObject.value = {
     6269                    postalCode: '',
     6270                };
     6271            }
     6272
     6273            var stripeObject = {};
     6274            var fontFamily = this.getStripeData('fontFamily');
     6275            var customFonts = this.getStripeData('customFonts');
     6276            if (fontFamily && customFonts) {
     6277                stripeObject.fonts = [
     6278                    {
     6279                        cssSrc: 'https://fonts.bunny.net/css?family=' + fontFamily,
     6280                    }
     6281                ];
     6282            }
     6283
     6284            var elements = this._stripe.elements(stripeObject);
     6285
     6286            this._cardElement = elements.create('card', Object.assign(
     6287                {
     6288                    classes: {
     6289                        base: this.getStripeData('baseClass'),
     6290                        complete: this.getStripeData('completeClass'),
     6291                        empty: this.getStripeData('emptyClass'),
     6292                        focus: this.getStripeData('focusedClass'),
     6293                        invalid: this.getStripeData('invalidClass'),
     6294                        webkitAutofill: this.getStripeData('autofilledClass'),
     6295                    },
     6296                    style: {
     6297                        base: {
     6298                            iconColor: this.getStripeData( 'iconColor' ),
     6299                            color: this.getStripeData( 'fontColor' ),
     6300                            lineHeight: this.getStripeData( 'lineHeight' ),
     6301                            fontWeight: this.getStripeData( 'fontWeight' ),
     6302                            fontFamily: this.getStripeData( 'fontFamily' ),
     6303                            fontSmoothing: 'antialiased',
     6304                            fontSize: this.getStripeData( 'fontSize' ),
     6305                            '::placeholder': {
     6306                                color: this.getStripeData( 'placeholder' ),
     6307                            },
     6308                            ':hover': {
     6309                                iconColor: this.getStripeData( 'iconColorHover' ),
     6310                            },
     6311                            ':focus': {
     6312                                iconColor: this.getStripeData( 'iconColorFocus' ),
     6313                            }
     6314                        },
     6315                        invalid: {
     6316                            iconColor: this.getStripeData( 'iconColorError' ),
     6317                            color: this.getStripeData( 'fontColorError' ),
     6318                        },
     6319                    },
     6320                    iconStyle: 'solid',
     6321                    hideIcon: !cardIcon,
     6322                },
     6323                zipObject
     6324            ));
     6325            this._cardElement.mount('#card-element-' + fieldId);
     6326            this.validateCard();
     6327        },
     6328
     6329        validateCard: function () {
     6330            var self = this;
     6331            this._cardElement.on( 'change', function( event ) {
     6332                if ( self.$el.find( '.forminator-stripe-element' ).hasClass( 'StripeElement--empty' ) ) {
     6333                    self.$el.find( '.forminator-stripe-element' ).closest( '.forminator-field' ).removeClass( 'forminator-is_filled' );
     6334                } else {
     6335                    self.$el.find( '.forminator-stripe-element' ).closest( '.forminator-field' ).addClass( 'forminator-is_filled' );
     6336                }
     6337
     6338                if ( self.$el.find( '.forminator-stripe-element' ).hasClass( 'StripeElement--invalid' ) ) {
     6339                    self.$el.find( '.forminator-stripe-element' ).closest( '.forminator-field' ).addClass( 'forminator-has_error' );
     6340                }
     6341            });
     6342
     6343            this._cardElement.on('focus', function(event) {
     6344                self.$el.find('.forminator-stripe-element').closest('.forminator-field').addClass('forminator-is_active');
     6345            });
     6346
     6347            this._cardElement.on('blur', function(event) {
     6348                self.$el.find('.forminator-stripe-element').closest('.forminator-field').removeClass('forminator-is_active');
     6349
     6350                self.isValid(false);
     6351            });
     6352        },
     6353
     6354        hideCardError: function () {
     6355            var $field_holder = this.$el.find('.forminator-card-message');
     6356            var $error_holder = $field_holder.find('.forminator-error-message');
     6357
     6358            if ($error_holder.length === 0) {
     6359                $field_holder.append('<span class="forminator-error-message" aria-hidden="true"></span>');
     6360                $error_holder = $field_holder.find('.forminator-error-message');
     6361            }
     6362
     6363            $field_holder.closest('.forminator-field').removeClass('forminator-has_error');
     6364            $error_holder.html('');
     6365        },
     6366
     6367        showCardError: function (message, focus) {
     6368            var $field_holder = this.$el.find('.forminator-card-message');
     6369            var $error_holder = $field_holder.find('.forminator-error-message');
     6370
     6371            if ($error_holder.length === 0) {
     6372                $field_holder.append('<span class="forminator-error-message" aria-hidden="true"></span>');
     6373                $error_holder = $field_holder.find('.forminator-error-message');
     6374            }
     6375
     6376            $field_holder.closest('.forminator-field').addClass('forminator-has_error');
     6377            $field_holder.closest('.forminator-field').addClass( 'forminator-is_filled' );
     6378            $error_holder.html(message);
     6379
     6380            if(focus) {
     6381                this.focus_to_element($field_holder.closest('.forminator-field'));
     6382            }
     6383        },
     6384
     6385        getStripeData: function (key) {
     6386            if ( (typeof this._stripeData !== 'undefined') && (typeof this._stripeData[key] !== 'undefined') ) {
     6387                return this._stripeData[key];
     6388            }
     6389
     6390            return null;
     6391        },
     6392
     6393        getObjectValue: function(object, key) {
     6394            if (typeof object[key] !== 'undefined') {
     6395                return object[key];
     6396            }
     6397
     6398            return null;
     6399        },
     6400
     6401        // taken from forminatorFrontCondition
     6402        get_form_field: function (element_id) {
     6403            //find element by suffix -field on id input (default behavior)
     6404            var $element = this.$el.find('#' + element_id + '-field');
     6405            if ($element.length === 0) {
     6406                //find element by its on name (for radio on singlevalue)
     6407                $element = this.$el.find('input[name=' + element_id + ']');
     6408                if ($element.length === 0) {
     6409                    // for text area that have uniqid, so we check its name instead
     6410                    $element = this.$el.find('textarea[name=' + element_id + ']');
     6411                    if ($element.length === 0) {
     6412                        //find element by its on name[] (for checkbox on multivalue)
     6413                        $element = this.$el.find('input[name="' + element_id + '[]"]');
     6414                        if ($element.length === 0) {
     6415                            //find element by select name
     6416                            $element = this.$el.find('select[name="' + element_id + '"]');
     6417                            if ($element.length === 0) {
     6418                                //find element by direct id (for name field mostly)
     6419                                //will work for all field with element_id-[somestring]
     6420                                $element = this.$el.find('#' + element_id);
     6421                            }
     6422                        }
     6423                    }
     6424                }
     6425            }
     6426
     6427            return $element;
     6428        },
     6429
     6430        get_field_value: function (element_id) {
     6431            var $element = this.get_form_field(element_id);
     6432            var value    = '';
     6433            var checked  = null;
     6434
     6435            if (this.field_is_radio($element)) {
     6436                checked = $element.filter(":checked");
     6437                if (checked.length) {
     6438                    value = checked.val();
     6439                }
     6440            } else if (this.field_is_checkbox($element)) {
     6441                $element.each(function () {
     6442                    if ($(this).is(':checked')) {
     6443                        value = $(this).val();
     6444                    }
     6445                });
     6446
     6447            } else if (this.field_is_select($element)) {
     6448                value = $element.val();
     6449            } else if ( this.field_has_inputMask( $element ) ) {
     6450                value = parseFloat( $element.inputmask( 'unmaskedvalue' ) );
     6451            } else {
     6452                value = $element.val()
     6453            }
     6454
     6455            return value;
     6456        },
     6457
     6458        get_field_calculation: function (element_id) {
     6459            var $element    = this.get_form_field(element_id);
     6460            var value       = 0;
     6461            var calculation = 0;
     6462            var checked     = null;
     6463
     6464            if (this.field_is_radio($element)) {
     6465                checked = $element.filter(":checked");
     6466                if (checked.length) {
     6467                    calculation = checked.data('calculation');
     6468                    if (calculation !== undefined) {
     6469                        value = Number(calculation);
     6470                    }
     6471                }
     6472            } else if (this.field_is_checkbox($element)) {
     6473                $element.each(function () {
     6474                    if ($(this).is(':checked')) {
     6475                        calculation = $(this).data('calculation');
     6476                        if (calculation !== undefined) {
     6477                            value += Number(calculation);
     6478                        }
     6479                    }
     6480                });
     6481
     6482            } else if (this.field_is_select($element)) {
     6483                checked = $element.find("option").filter(':selected');
     6484                if (checked.length) {
     6485                    calculation = checked.data('calculation');
     6486                    if (calculation !== undefined) {
     6487                        value = Number(calculation);
     6488                    }
     6489                }
     6490            } else {
     6491                value = Number($element.val());
     6492            }
     6493
     6494            return isNaN(value) ? 0 : value;
     6495        },
     6496
     6497        field_has_inputMask: function ( $element ) {
     6498            var hasMask = false;
     6499
     6500            $element.each(function () {
     6501                if ( undefined !== $( this ).attr( 'data-inputmask' ) ) {
     6502                    hasMask = true;
     6503                    //break
     6504                    return false;
     6505                }
     6506            });
     6507
     6508            return hasMask;
     6509        },
     6510
     6511        field_is_radio: function ($element) {
     6512            var is_radio = false;
     6513            $element.each(function () {
     6514                if ($(this).attr('type') === 'radio') {
     6515                    is_radio = true;
     6516                    //break
     6517                    return false;
     6518                }
     6519            });
     6520
     6521            return is_radio;
     6522        },
     6523
     6524        field_is_checkbox: function ($element) {
     6525            var is_checkbox = false;
     6526            $element.each(function () {
     6527                if ($(this).attr('type') === 'checkbox') {
     6528                    is_checkbox = true;
     6529                    //break
     6530                    return false;
     6531                }
     6532            });
     6533
     6534            return is_checkbox;
     6535        },
     6536
     6537        field_is_select: function ($element) {
     6538            return $element.is('select');
     6539        },
     6540    });
     6541
     6542    // A really lightweight plugin wrapper around the constructor,
     6543    // preventing against multiple instantiations
     6544    $.fn[pluginName] = function (options) {
     6545        return this.each(function () {
     6546            if (!$.data(this, pluginName)) {
     6547                $.data(this, pluginName, new ForminatorFrontPayment(this, options));
     6548            }
     6549        });
     6550    };
     6551
     6552})(jQuery, window, document);
     6553
     6554// the semi-colon before function invocation is a safety net against concatenated
     6555// scripts and/or other plugins which may not be closed properly.
     6556;// noinspection JSUnusedLocalSymbols
     6557(function ($, window, document, undefined) {
     6558
     6559    "use strict";
     6560
     6561    // undefined is used here as the undefined global variable in ECMAScript 3 is
     6562    // mutable (ie. it can be changed by someone else). undefined isn't really being
     6563    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     6564    // can no longer be modified.
     6565
     6566    // window and document are passed through as local variables rather than global
     6567    // as this (slightly) quickens the resolution process and can be more efficiently
     6568    // minified (especially when both are regularly referenced in your plugin).
     6569
     6570    // Create the defaults once
     6571    var pluginName = "forminatorFrontPagination",
     6572        defaults = {
     6573            totalSteps: 0,
     6574            step: 0,
     6575            hashStep: 0,
     6576            inline_validation: false
     6577        };
     6578
     6579    // The actual plugin constructor
     6580    function ForminatorFrontPagination(element, options) {
     6581        this.element = $(element);
     6582        this.$el = this.element;
     6583        this.totalSteps = 0;
     6584        this.step = 0;
     6585        this.finished = false;
     6586        this.hashStep = false;
     6587        this.next_button_txt = '';
     6588        this.prev_button_txt = '';
     6589        this.custom_label = [];
     6590        this.form_id = 0;
     6591        this.element = '';
     6592
     6593        // jQuery has an extend method which merges the contents of two or
     6594        // more objects, storing the result in the first object. The first object
     6595        // is generally empty as we don't want to alter the default options for
     6596        // future instances of the plugin
     6597        this.settings = $.extend({}, defaults, options);
     6598        this._defaults = defaults;
     6599        this._name = pluginName;
     6600        this.init();
     6601    }
     6602
     6603    // Avoid Plugin.prototype conflicts
     6604    $.extend(ForminatorFrontPagination.prototype, {
     6605        init: function () {
     6606            var self = this;
     6607            var draftPage = !! this.$el.data( 'draft-page' ) ? this.$el.data( 'draft-page' ) : 0;
     6608
     6609            this.next_button = this.settings.next_button ? this.settings.next_button : window.ForminatorFront.cform.pagination_next;
     6610            this.prev_button = this.settings.prev_button ? this.settings.prev_button : window.ForminatorFront.cform.pagination_prev;
     6611
     6612            if (this.$el.find('input[name=form_id]').length > 0) {
     6613                this.form_id = this.$el.find('input[name=form_id]').val();
     6614            }
     6615
     6616            this.totalSteps = this.settings.totalSteps;
     6617            this.step = this.settings.step;
     6618            this.quiz = this.settings.quiz;
     6619            this.element = this.$el.find('[data-step=' + this.step + ']').data('name');
     6620            if (this.form_id && typeof window.Forminator_Cform_Paginations === 'object' && typeof window.Forminator_Cform_Paginations[this.form_id] === 'object') {
     6621                this.custom_label = window.Forminator_Cform_Paginations[this.form_id];
     6622            }
     6623
     6624            if ( draftPage > 0 ) {
     6625                this.go_to( draftPage, true );
     6626            } else if (this.settings.hashStep && this.step > 0) {
     6627                this.go_to(this.step, true);
     6628            } else if ( this.quiz ) {
     6629                this.go_to(0, true);
     6630            } else {
     6631                this.go_to(0, false);
     6632            }
     6633
     6634            this.render_navigation();
     6635            this.render_bar_navigation();
     6636            this.render_footer_navigation( this.form_id );
     6637            this.init_events();
     6638            this.update_buttons();
     6639            this.update_navigation();
     6640
     6641            this.$el.find('.forminator-button.forminator-button-back, .forminator-button.forminator-button-next, .forminator-button.forminator-button-submit').on("click", function (e) {
     6642                e.preventDefault();
     6643                $(this).trigger('forminator.front.pagination.move');
     6644                self.resetRichTextEditorHeight();
     6645            });
     6646
     6647            this.$el.on('click', '.forminator-result--view-answers', function(e){
     6648                e.preventDefault();
     6649                $(this).trigger('forminator.front.pagination.move');
     6650            });
     6651
     6652        },
     6653        init_events: function () {
     6654            var self = this;
     6655
     6656            this.$el.find('.forminator-button-back').on('forminator.front.pagination.move',function (e) {
     6657                self.handle_click('prev');
     6658            });
     6659            this.$el.on('forminator.front.pagination.move', '.forminator-result--view-answers', function (e) {
     6660                self.handle_click('prev');
     6661            });
     6662            this.$el.find('.forminator-button-next').on('forminator.front.pagination.move', function (e) {
     6663                self.handle_click('next');
     6664            });
     6665
     6666            this.$el.find('.forminator-step').on("click", function (e) {
     6667                e.preventDefault();
     6668                var step = $(this).data('nav');
     6669                self.handle_step(step);
     6670            });
     6671
     6672            this.$el.on('reset', function (e) {
     6673                self.on_form_reset(e);
     6674            });
     6675
     6676            this.$el.on('forminator:quiz:submit:success', function (e, ajaxData, formData, resultText) {
     6677                if ( resultText ) {
     6678                    self.move_to_results(e);
     6679                }
     6680            });
     6681
     6682            this.$el.on('forminator.front.pagination.focus.input', function (e, input) {
     6683                self.on_focus_input(e, input);
     6684            });
     6685
     6686        },
     6687
     6688        /**
     6689         * Move quiz to rezult page
     6690         */
     6691        move_to_results: function (e) {
     6692            this.finished = true;
     6693            if ( this.$el.find('.forminator-submit-rightaway').length ) {
     6694                this.$el.find('#forminator-submit').removeClass('forminator-hidden');
     6695            } else {
     6696                this.handle_click('next');
     6697            }
     6698        },
     6699
     6700        /**
     6701         * On reset event of Form
     6702         *
     6703         * @since 1.0.3
     6704         *
     6705         * @param e
     6706         */
     6707        on_form_reset: function (e) {
     6708            // Trigger pagination to first page
     6709            this.go_to(0, true);
     6710            this.update_buttons();
     6711        },
     6712
     6713        /**
     6714         * On Input focused
     6715         *
     6716         * @param e
     6717         * @param input
     6718         */
     6719        on_focus_input: function (e, input) {
     6720            //Go to page where element exist
     6721            var step = this.get_page_of_input(input);
     6722            this.go_to(step, true);
     6723            this.update_buttons();
     6724        },
     6725        render_footer_navigation: function( form_id ) {
     6726            var footer_html = '',
     6727                paypal_field = '',
     6728                footer_align = ( this.custom_label['has-paypal'] === true ) ? ' style="align-items: flex-start;"' : '',
     6729                save_draft_btn = this.$el.find( '.forminator-save-draft-link' ).length ? this.$el.find( '.forminator-save-draft-link' ) : ''
     6730                ;
     6731
     6732            if ( this.custom_label[ this.element ] && this.custom_label[ 'pagination-labels' ] === 'custom' ){
     6733                this.prev_button_txt = this.custom_label[ this.element ][ 'prev-text' ] !== '' ? this.custom_label[ this.element ][ 'prev-text' ] : this.prev_button;
     6734                this.next_button_txt = this.custom_label[ this.element ][ 'next-text' ] !== '' ? this.custom_label[ this.element ][ 'next-text' ] : this.next_button;
     6735            } else {
     6736                this.prev_button_txt = this.prev_button;
     6737                this.next_button_txt = this.next_button;
     6738            }
     6739
     6740            if ( this.$el.hasClass('forminator-design--material') ) {
     6741                footer_html = '<div class="forminator-pagination-footer"' + footer_align + '>' +
     6742                    '<button class="forminator-button forminator-button-back"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">' + this.prev_button_txt + '</span></button>' +
     6743                    '<button class="forminator-button forminator-button-next"><span class="forminator-button--mask" aria-label="hidden"></span><span class="forminator-button--text">' + this.next_button_txt + '</span></button>';
     6744                if( this.custom_label[ 'has-paypal' ] === true ) {
     6745                    paypal_field = ( this.custom_label['paypal-id'] ) ? this.custom_label['paypal-id'] : '';
     6746                    footer_html += '<div class="forminator-payment forminator-button-paypal forminator-hidden ' + paypal_field + '-payment" id="paypal-button-container-' + form_id + '">';
     6747                }
     6748                footer_html += '</div>';
     6749                this.$el.append( footer_html );
     6750
     6751            } else {
     6752                footer_html = '<div class="forminator-pagination-footer"' + footer_align + '>' +
     6753                    '<button class="forminator-button forminator-button-back">' + this.prev_button_txt + '</button>' +
     6754                    '<button class="forminator-button forminator-button-next">' + this.next_button_txt + '</button>';
     6755                if( this.custom_label['has-paypal'] === true ) {
     6756                    paypal_field = ( this.custom_label['paypal-id'] ) ? this.custom_label['paypal-id'] : '';
     6757                    footer_html += '<div class="forminator-payment forminator-button-paypal forminator-hidden ' + paypal_field + '-payment" id="paypal-button-container-' + form_id + '">';
     6758                }
     6759                footer_html += '</div>';
     6760                this.$el.append( footer_html );
     6761
     6762            }
     6763
     6764            if ( '' !== save_draft_btn ) {
     6765                save_draft_btn.insertBefore( this.$el.find( '.forminator-button-next' ) );
     6766            }
     6767
     6768        },
     6769
     6770        render_bar_navigation: function () {
     6771
     6772            var $navigation = this.$el.find( '.forminator-pagination-progress' );
     6773
     6774            var $progressLabel = '<div class="forminator-progress-label">0%</div>',
     6775                $progressBar   = '<div class="forminator-progress-bar"><span style="width: 0%"></span></div>'
     6776            ;
     6777
     6778            if ( ! $navigation.length ) return;
     6779
     6780            $navigation.html( $progressLabel + $progressBar );
     6781
     6782            this.calculate_bar_percentage();
     6783
     6784        },
     6785
     6786        calculate_bar_percentage: function () {
     6787
     6788            var total     = this.totalSteps,
     6789                current   = this.step + 1,
     6790                $progress = this.$el
     6791            ;
     6792
     6793            if ( ! $progress.length ) return;
     6794
     6795            var percentage = Math.round( (current / total) * 100 );
     6796
     6797            $progress.find( '.forminator-progress-label' ).html( percentage + '%' );
     6798            $progress.find( '.forminator-progress-bar span' ).css( 'width', percentage + '%' );
     6799
     6800        },
     6801
     6802        render_navigation: function () {
     6803            var $navigation = this.$el.find('.forminator-pagination-steps');
     6804
     6805            var finalSteps = this.$el.find('.forminator-pagination-start');
     6806
     6807            if ( ! $navigation.length ) return;
     6808
     6809            const render = $( this.$el ).data( 'forminator-render' ) || '';
     6810
     6811            var steps = this.$el.find( '.forminator-pagination' ).not( '.forminator-pagination-start' );
     6812
     6813            $navigation.append( '<div class="forminator-break"></div>' );
     6814
     6815            var self = this;
     6816
     6817            steps.each( function() {
     6818
     6819                var $step        = $( this ),
     6820                    $stepLabel   = $step.data( 'label' ),
     6821                    $stepNumb    = $step.data('step') - 1,
     6822                    $stepControl = 'forminator-custom-form-' + self.form_id + '-' + render + '--page-' + $stepNumb,
     6823                    $stepId      = $stepControl + '-label'
     6824                ;
     6825
     6826                var $stepMarkup = '<button role="tab" id="' + $stepId + '" class="forminator-step forminator-step-' + $stepNumb + '" aria-selected="false" aria-controls="' + $stepControl + '" data-nav="' + $stepNumb + '">' +
     6827                    '<span class="forminator-step-label">' + $stepLabel + '</span>' +
     6828                    '<span class="forminator-step-dot" aria-hidden="true"></span>' +
     6829                '</button>';
     6830
     6831                var $stepBreak = '<div class="forminator-break" aria-hidden="true"></div>';
     6832
     6833                $navigation.append( $stepMarkup + $stepBreak );
     6834
     6835            });
     6836
     6837            finalSteps.each(function () {
     6838                var $step   = $(this),
     6839                    label   = $step.data('label'),
     6840                    numb    = steps.length,
     6841                    control = 'forminator-custom-form-' + self.form_id + '--page-' + numb,
     6842                    stepid  = control + '-label'
     6843                ;
     6844
     6845                var $stepMarkup = '<button role="tab" id="' + stepid + '" class="forminator-step forminator-step-' + numb + '" data-nav="' + numb + '" aria-selected="false" aria-controls="' + control + '">' +
     6846                    '<span class="forminator-step-label">' + label + '</span>' +
     6847                    '<span class="forminator-step-dot" aria-hidden="true"></span>' +
     6848                '</button>';
     6849
     6850                var $stepBreak = '<div class="forminator-break" aria-hidden="true"></div>';
     6851
     6852                $navigation.append( $stepMarkup + $stepBreak );
     6853            });
     6854        },
     6855
     6856        /**
     6857         * Handle step click
     6858         *
     6859         * @param step
     6860         */
     6861        handle_step: function( step ) {
     6862            if ( this.settings.inline_validation ) {
     6863                for ( var i = 0; i < step; i++ ) {
     6864                    if ( this.step <= i ) {
     6865                        if ( ! this.is_step_inputs_valid( i ) ) {
     6866                            this.go_to( i, true );
     6867                            return;
     6868                        }
     6869                    }
     6870                }
     6871            }
     6872            this.go_to( step, true );
     6873            this.update_buttons();
     6874        },
     6875
     6876        handle_click: function (type) {
     6877            var self = this;
     6878            if (type === "prev" && this.step !== 0) {
     6879                this.go_to(this.step - 1, true);
     6880                this.update_buttons();
     6881            } else if (type === "next") {
     6882                //do validation before next if inline validation enabled
     6883                if (this.settings.inline_validation) {
     6884                    if ( ! this.is_step_inputs_valid( this.step ) ) {
     6885                        return;
     6886                    }
     6887                }
     6888
     6889                if(typeof this.$el.data().forminatorFrontPayment !== "undefined") {
     6890                    var payment = this.$el.data().forminatorFrontPayment,
     6891                        page = this.$el.find('[data-step=' + this.step + ']'),
     6892                        hasStripe = page.find(".forminator-stripe-element").not(".forminator-hidden .forminator-stripe-element")
     6893                    ;
     6894
     6895
     6896                    // Check if Stripe exists on current step
     6897                    if (hasStripe.length > 0) {
     6898                        payment._stripe.createToken(payment._cardElement).then(function (result) {
     6899                            if (result.error) {
     6900                                payment.showCardError(result.error.message, true);
     6901                            } else {
     6902                                payment.hideCardError();
     6903                                self.go_to(self.step + 1, true);
     6904                                self.update_buttons();
     6905                            }
     6906                        });
     6907                    } else {
     6908                        this.go_to(this.step + 1, true);
     6909                        this.update_buttons();
     6910                    }
     6911                } else {
     6912                    this.go_to(this.step + 1, true);
     6913                    this.update_buttons();
     6914                }
     6915            }
     6916
     6917            // re-init textarea floating labels.
     6918            var form = $( this.$el );
     6919            var textarea = form.find( '.forminator-textarea' );
     6920            var isMaterial = form.hasClass( 'forminator-design--material' );
     6921
     6922            if ( isMaterial ) {
     6923                if ( textarea.length ) {
     6924                    textarea.each( function() {
     6925                        FUI.textareaMaterial( this );
     6926                    });
     6927                }
     6928            }
     6929        },
     6930
     6931        /**
     6932         * Check current inputs on step is in valid state
     6933         */
     6934        is_step_inputs_valid: function ( step ) {
     6935            var valid = true,
     6936                errors = 0,
     6937                validator = this.$el.data('validator'),
     6938                page = this.$el.find('[data-step=' + step + ']');
     6939
     6940            //inline validation disabled
     6941            if (typeof validator === 'undefined') {
     6942                return true;
     6943            }
     6944
     6945            //get fields on current page
     6946            page.find("input, select, textarea")
     6947                .not(":submit, :reset, :image, :disabled")
     6948                .not(':hidden:not(.forminator-wp-editor-required, .forminator-input-file-required, input[name$="_data"])')
     6949                .not('[gramm="true"]')
     6950                .each(function (key, element) {
     6951                    valid = validator.element(element);
     6952
     6953                    if (!valid) {
     6954                        if (errors === 0) {
     6955                            // focus on first error
     6956                            element.focus();
     6957                        }
     6958                        errors++;
     6959                    }
     6960                });
     6961
     6962            return errors === 0;
     6963        },
     6964
     6965        /**
     6966         * Get page on the input
     6967         *
     6968         * @since 1.0.3
     6969         *
     6970         * @param input
     6971         * @returns {number|*}
     6972         */
     6973        get_page_of_input: function(input) {
     6974            var step_page = this.step;
     6975            var page = $(input).closest('.forminator-pagination');
     6976            if (page.length > 0) {
     6977                var step = $(page).data('step');
     6978                if (typeof step !== 'undefined') {
     6979                    step_page = +step;
     6980                }
     6981            }
     6982
     6983            return step_page;
     6984        },
     6985
     6986        update_buttons: function () {
     6987            var hasDraft = this.$el.hasClass( 'draft-enabled' ),
     6988                self     = this;
     6989
     6990            if (this.step === 0) {
     6991                if ( ! hasDraft ) {
     6992                    this.$el.find('.forminator-button-back').closest( '.forminator-pagination-footer' ).css({
     6993                        'justify-content': 'flex-end'
     6994                    });
     6995                }
     6996
     6997                this.$el.find('.forminator-button-back').addClass( 'forminator-hidden' );
     6998                this.$el.find('.forminator-button-next').removeClass('forminator-hidden');
     6999            } else {
     7000                if ( this.totalSteps > 1 ) {
     7001                    if ( ! hasDraft ) {
     7002                        this.$el.find('.forminator-button-back').closest( '.forminator-pagination-footer' ).css({
     7003                            'justify-content': 'space-between'
     7004                        });
     7005                    }
     7006
     7007                    this.$el.find('.forminator-button-back, .forminator-button-next').removeClass('forminator-hidden');
     7008                }
     7009            }
     7010
     7011            if (this.step === this.totalSteps && ! this.finished ) {
     7012                //keep pagination content on last step before submit
     7013                this.step--;
     7014                this.$el.trigger( 'submit' );
     7015            }
     7016
     7017            var submitButtonClass = this.settings.submitButtonClass;
     7018            if ( this.step === ( this.totalSteps - 1 ) && ! this.finished ) {
     7019
     7020                var submit_button_text = this.$el.find('.forminator-pagination-submit').html(),
     7021                    loadingText = this.$el.find('.forminator-pagination-submit').data('loading'),
     7022                    last_button_txt = ( this.custom_label[ 'pagination-labels' ] === 'custom'
     7023                        && this.custom_label['last-previous'] !== '' ) ? this.custom_label['last-previous'] : this.prev_button,
     7024                    forminatorPayment = self.$el.find('.forminator-payment'),
     7025                    nextBtn = this.$el.find('.forminator-button-next'),
     7026                    submitButton = this.$el.find( '.forminator-button-submit' );
     7027
     7028                if ( this.$el.hasClass('forminator-design--material') ) {
     7029
     7030                    this.$el.find('.forminator-button-back .forminator-button--text').html( last_button_txt );
     7031                    nextBtn.removeClass('forminator-button-next').attr('id', 'forminator-submit');
     7032
     7033                    setTimeout(
     7034                        function() {
     7035                            nextBtn
     7036                            .addClass('forminator-button-submit ' + submitButtonClass )
     7037                            .find('.forminator-button--text')
     7038                            .html('')
     7039                            .html(submit_button_text).data('loading', loadingText);
     7040                        },
     7041                        20
     7042                    );
     7043                } else {
     7044                    this.$el.find('.forminator-button-back').html( last_button_txt );
     7045                    nextBtn.removeClass( 'forminator-button-next' ).attr( 'id', 'forminator-submit' );
     7046
     7047                    setTimeout(
     7048                        function() {
     7049                            nextBtn
     7050                            .addClass( 'forminator-button-submit ' + submitButtonClass )
     7051                            .html( submit_button_text ).data('loading', loadingText);
     7052                        },
     7053                        20
     7054                    );
     7055                }
     7056
     7057                // Redeclare submit button.
     7058                setTimeout(
     7059                    function() {
     7060                        submitButton = self.$el.find( '.forminator-button-submit' );
     7061                    },
     7062                    30
     7063                );
     7064
     7065                if ( this.$el.hasClass('forminator-quiz') && ! submit_button_text ) {
     7066                    submitButton.addClass('forminator-hidden');
     7067                    if ( this.$el.find( '.forminator-submit-rightaway').length ) {
     7068                        submitButton.html( window.ForminatorFront.quiz.view_results );
     7069                    }
     7070                }
     7071
     7072                if( this.custom_label['has-paypal'] === true ) {
     7073                    forminatorPayment.attr('id', 'forminator-paypal-submit');
     7074
     7075                    setTimeout(
     7076                        function() {
     7077                            if ( ! window.paypalHasCondition.includes( self.$el.data( 'form-id' ) ) ) {
     7078                                submitButton.addClass('forminator-hidden');
     7079                                forminatorPayment.removeClass( 'forminator-hidden' );
     7080                            }
     7081                        },
     7082                        40
     7083                    );
     7084                }
     7085
     7086                if ( forminatorPayment.find('iframe').length > 0 ) {
     7087                    forminatorPayment.find('iframe').width('100%');
     7088                }
     7089
     7090            } else {
     7091                this.element = this.$el.find('[data-step=' + this.step + ']').data('name');
     7092                if ( this.custom_label[this.element] && this.custom_label['pagination-labels'] === 'custom'){
     7093                    this.prev_button_txt = this.custom_label[this.element]['prev-text'] !== '' ? this.custom_label[this.element]['prev-text'] : this.prev_button;
     7094                    this.next_button_txt = this.custom_label[this.element]['next-text'] !== '' ? this.custom_label[this.element]['next-text'] : this.next_button;
     7095                }else{
     7096                    this.prev_button_txt = this.prev_button;
     7097                    this.next_button_txt = this.next_button;
     7098                }
     7099                if ( this.step === ( this.totalSteps - 1 ) && this.finished ) {
     7100                    this.next_button_txt = window.ForminatorFront.quiz.view_results;
     7101                }
     7102                if ( this.$el.hasClass('forminator-design--material') ) {
     7103                    this.$el.find( '#forminator-submit' )
     7104                        .removeAttr( 'id' )
     7105                        .removeClass( 'forminator-button-submit forminator-hidden ' + submitButtonClass )
     7106                        .addClass( 'forminator-button-next' );
     7107                    if( this.custom_label['has-paypal'] === true ) {
     7108                        this.$el.find( '#forminator-paypal-submit' ).removeAttr( 'id' ).addClass('forminator-hidden');
     7109                        this.$el.find( '.forminator-button-next' ).removeClass( 'forminator-button-submit forminator-hidden ' + submitButtonClass );
     7110                    }
     7111
     7112                    this.$el.find( '.forminator-button-back .forminator-button--text' ).html( this.prev_button_txt );
     7113                    this.$el.find( '.forminator-button-next .forminator-button--text' ).html( this.next_button_txt );
     7114
     7115                } else {
     7116                    this.$el.find( '#forminator-submit' )
     7117                        .removeAttr( 'id' )
     7118                        .removeClass( 'forminator-button-submit forminator-hidden' )
     7119                        .addClass( 'forminator-button-next' );
     7120                    if( this.custom_label['has-paypal'] === true ) {
     7121                        this.$el.find( '#forminator-paypal-submit' ).removeAttr( 'id' ).addClass('forminator-hidden');
     7122                        this.$el.find('.forminator-button-next').removeClass( 'forminator-button-submit forminator-hidden' );
     7123                    }
     7124                    this.$el.find( '.forminator-button-back' ).html( this.prev_button_txt );
     7125                    this.$el.find( '.forminator-button-next' ).html( this.next_button_txt );
     7126
     7127                }
     7128                if ( this.step === this.totalSteps && this.finished ) {
     7129                    this.$el.find('.forminator-button-next, .forminator-button-back').addClass( 'forminator-hidden' );
     7130                }
     7131            }
     7132            // Reset the conditions to check if submit/paypal buttons should be visible
     7133            this.$el.trigger( 'forminator.front.condition.restart' );
     7134        },
     7135
     7136        go_to: function (step, scrollToTop) {
     7137            this.step = step;
     7138
     7139            if (step === this.totalSteps && ! this.finished ) return false;
     7140
     7141            // Hide all parts
     7142            this.$el.find('.forminator-pagination').css({
     7143                'height': '0',
     7144                'opacity': '0',
     7145                'visibility': 'hidden'
     7146            }).attr( 'aria-hidden', 'true' ).attr( 'hidden', true );
     7147
     7148            this.$el.find('.forminator-pagination .forminator-pagination--content').hide();
     7149
     7150            // Show desired page
     7151            this.$el.find('[data-step=' + step + ']').css({
     7152                'height': 'auto',
     7153                'opacity': '1',
     7154                'visibility': 'visible'
     7155            }).removeAttr( 'aria-hidden' ).removeAttr( 'hidden' );
     7156
     7157            this.$el.find('[data-step=' + step + '] .forminator-pagination--content').show();
     7158
     7159            //exec responsive captcha
     7160            var forminatorFront = this.$el.data('forminatorFront');
     7161            if (typeof forminatorFront !== 'undefined') {
     7162                forminatorFront.responsive_captcha();
     7163            }
     7164
     7165            this.update_navigation();
     7166
     7167            if (scrollToTop) {
     7168                this.scroll_to_top_form();
     7169            }
     7170        },
     7171
     7172        update_navigation: function () {
     7173
     7174            // Update navigation
     7175            this.$el.find( '.forminator-current' ).attr( 'aria-selected', 'false' );
     7176            this.$el.find( '.forminator-current' ).removeClass('forminator-current' );
     7177            this.$el.find( '.forminator-step-' + this.step ).attr( 'aria-selected', 'true' );
     7178            this.$el.find( '.forminator-step-' + this.step ).addClass( 'forminator-current' );
     7179
     7180            this.$el.find( '.forminator-pagination:not(:hidden)' ).find( '.forminator-answer input' ).first().trigger( 'change' );
     7181
     7182            this.calculate_bar_percentage();
     7183        },
     7184
     7185        /**
     7186         * Reset vertical screen position between sections
     7187         * https://app.asana.com/0/385581670491499/784073712068017/f
     7188         * Support Hustle Modal
     7189         */
     7190        scroll_to_top_form: function () {
     7191            var self            = this;
     7192            var $element        = this.$el;
     7193            // find first input row
     7194            var first_input_row = this.$el.find('.forminator-row').not(':hidden').first();
     7195            if (first_input_row.length) {
     7196                $element = first_input_row;
     7197            }
     7198
     7199            if ($element.length) {
     7200                var parent_selector = 'html,body';
     7201
     7202                // check inside sui modal
     7203                if (this.$el.closest('.sui-dialog').length > 0) {
     7204                    parent_selector = '.sui-dialog';
     7205                }
     7206
     7207                // check inside hustle modal (prioritize)
     7208                if (this.$el.closest('.wph-modal').length > 0) {
     7209                    parent_selector = '.wph-modal';
     7210                }
     7211
     7212                $element.focus();
     7213
     7214                var scrollTop = ($element.offset().top - ($(window).height() - $element.outerHeight(true)) / 2);
     7215                if ( this.quiz ) {
     7216                    scrollTop = $element.offset().top;
     7217                    if ( $('#wpadminbar').length ) {
     7218                        scrollTop -= 35;
     7219                    }
     7220                }
     7221
     7222                $(parent_selector).animate({scrollTop: scrollTop}, 500, function () {
     7223                    if (!$element.attr("tabindex")) {
     7224                        $element.attr("tabindex", -1);
     7225                    }
     7226                });
     7227            }
     7228
     7229        },
     7230
     7231        resetRichTextEditorHeight: function () {
     7232            if ( typeof tinyMCE !== 'undefined' ) {
     7233                var form = this.$el,
     7234                    textarea = form.find( '.forminator-textarea' );
     7235
     7236                textarea.each( function() {
     7237                    var tmceId = $( this ).attr( 'id' );
     7238
     7239                    if ( 0 !== form.find( '#'+ tmceId + '_ifr' ).length && form.find( '#'+ tmceId + '_ifr' ).is( ':visible' ) ) {
     7240                        form.find( '#' + tmceId + '_ifr' ).height( $( this ).height() );
     7241                    }
     7242                });
     7243            }
     7244        },
     7245    });
     7246
     7247    // A really lightweight plugin wrapper around the constructor,
     7248    // preventing against multiple instantiations
     7249    $.fn[pluginName] = function (options) {
     7250        return this.each(function () {
     7251            if (!$.data(this, pluginName)) {
     7252                $.data(this, pluginName, new ForminatorFrontPagination(this, options));
     7253            }
     7254        });
     7255    };
     7256
     7257})(jQuery, window, document);
     7258
     7259// the semi-colon before function invocation is a safety net against concatenated
     7260// scripts and/or other plugins which may not be closed properly.
     7261;// noinspection JSUnusedLocalSymbols
     7262(function ($, window, document, undefined) {
     7263
     7264    "use strict";
     7265
     7266    // undefined is used here as the undefined global variable in ECMAScript 3 is
     7267    // mutable (ie. it can be changed by someone else). undefined isn't really being
     7268    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     7269    // can no longer be modified.
     7270
     7271    // window and document are passed through as local variables rather than global
     7272    // as this (slightly) quickens the resolution process and can be more efficiently
     7273    // minified (especially when both are regularly referenced in your plugin).
     7274
     7275    // Create the defaults once
     7276    var pluginName = "forminatorFrontPayPal",
     7277        defaults   = {
     7278            type: 'paypal',
     7279            paymentEl: null,
     7280            paymentRequireSsl: false,
     7281            generalMessages: {},
     7282        };
     7283
     7284    // The actual plugin constructor
     7285    function ForminatorFrontPayPal(element, options) {
     7286        this.element = element;
     7287        this.$el     = $(this.element);
     7288        this.forminator_selector = '#' + this.$el.attr('id') + '[data-forminator-render="' + this.$el.data('forminator-render') + '"]';
     7289
     7290        // jQuery has an extend method which merges the contents of two or
     7291        // more objects, storing the result in the first object. The first object
     7292        // is generally empty as we don't want to alter the default options for
     7293        // future instances of the plugin
     7294        this.settings              = $.extend({}, defaults, options);
     7295        this._defaults             = defaults;
     7296        this._name                 = pluginName;
     7297        this.paypalData            = null;
     7298        this.paypalButton          = null;
     7299        this.init();
     7300    }
     7301
     7302    // Avoid Plugin.prototype conflicts
     7303    $.extend(ForminatorFrontPayPal.prototype, {
     7304        init: function () {
     7305            if (!this.settings.paymentEl) {
     7306                return;
     7307            }
     7308
     7309            this.paypalData = this.settings.paymentEl;
     7310
     7311            this.render_paypal_button( this.element );
     7312            this.replaceScriptCurrency();
     7313        },
     7314
     7315        is_data_valid: function() {
     7316            var paypalData = this.configurePayPal(),
     7317                requireSsl = this.settings.paymentRequireSsl
     7318            ;
     7319
     7320            if ( paypalData.amount <= 0 ) {
     7321                return false;
     7322            }
     7323
     7324            if ( requireSsl && 'https:' !== location.protocol ) {
     7325                return false;
     7326            }
     7327
     7328            return true;
     7329        },
     7330
     7331        is_form_valid: function() {
     7332            var validate = this.$el.validate(); // Get validate instance
     7333            var isValid = validate.checkForm(); // Valid?
     7334            validate.submitted = {}; // Reset immediate form field checking mode
     7335
     7336            return isValid;
     7337        },
     7338
     7339        render_paypal_button: function ( form ) {
     7340            var $form = $( form ),
     7341                self = this,
     7342                paypalData = this.configurePayPal(),
     7343                $target_message = $form.find('.forminator-response-message'),
     7344                paypalActions,
     7345                error_msg = ForminatorFront.cform.gateway.error,
     7346                requireSsl = this.settings.paymentRequireSsl,
     7347                generalMessage = this.settings.generalMessages,
     7348                style_data = {
     7349                    shape: paypalData.shape,
     7350                    color: paypalData.color,
     7351                    label: paypalData.label,
     7352                    layout: paypalData.layout,
     7353                    height: parseInt( paypalData.height ),
     7354                };
     7355
     7356            if( paypalData.layout !== 'vertical' ) {
     7357                style_data.tagline =  paypalData.tagline;
     7358            }
     7359
     7360            this.paypalButton = paypal.Buttons({
     7361                onInit: function(data, actions) {
     7362                    actions.disable();
     7363
     7364                    if ( paypalData.amount_type === 'variable' && paypalData.variable !== '' ) {
     7365                        paypalData.amount = self.get_field_calculation( paypalData.variable );
     7366                    }
     7367
     7368                    // Listen for form field changes
     7369                    $form.find('input, select, textarea, .forminator-field-signature').on( 'change', function() {
     7370                        if ( self.is_data_valid() && self.is_form_valid() ) {
     7371                            actions.enable();
     7372                            if ( $target_message.hasClass('forminator-error') ) {
     7373                                $target_message.html( '' ).attr( "aria-hidden", "true" );
     7374                                // In case of payment failed error
     7375                                $target_message.removeClass('forminator-show');
     7376                            }
     7377                        } else {
     7378                            actions.disable();
     7379                        }
     7380                    });
     7381
     7382                    // Check if form has error to disable actions
     7383                    $form.on( 'validation:error', function() {
     7384                        actions.disable();
     7385                    });
     7386
     7387                    // Check if uploads has no error to enable actions
     7388                    $form.on( 'forminator:uploads:valid', function() {
     7389                        if ( self.is_data_valid() && self.is_form_valid() ) {
     7390                            actions.enable();
     7391                        }
     7392                    });
     7393
     7394                    // Check if the form is valid on init
     7395                    if ( self.is_data_valid() && self.is_form_valid() ) {
     7396                        actions.enable();
     7397                    }
     7398                },
     7399
     7400                env: paypalData.mode,
     7401                style: style_data,
     7402                onClick: function () {
     7403                    if( ! $form.valid() && paypalData.amount <= 0 ) {
     7404                        $target_message.removeClass('forminator-accessible').addClass('forminator-error').html('').removeAttr( 'aria-hidden' );
     7405                        $target_message.html('<label class="forminator-label--error"><span>' + generalMessage.payment_require_amount_error + '</span></label>');
     7406                        self.focus_to_element($target_message);
     7407                    } else if ( requireSsl && 'https:' !== location.protocol ) {
     7408                        $target_message.removeClass('forminator-accessible').addClass('forminator-error').html('').removeAttr( 'aria-hidden' );
     7409                        $target_message.html('<label class="forminator-label--error"><span>' + generalMessage.payment_require_ssl_error + '</span></label>');
     7410                        self.focus_to_element($target_message);
     7411                    } else if ( ! $form.valid() ) {
     7412                        $target_message.removeClass('forminator-accessible').addClass('forminator-error').html('').removeAttr( 'aria-hidden' );
     7413                        $target_message.html('<label class="forminator-label--error"><span>' + generalMessage.form_has_error + '</span></label>');
     7414                        self.focus_to_element($target_message);
     7415                    } else {
     7416                        $form.trigger( 'forminator:preSubmit:paypal', [ $target_message ] );
     7417                        if ( $target_message.html() ) {
     7418                            self.focus_to_element($target_message);
     7419                            return false;
     7420                        }
     7421                    }
     7422
     7423                    if ( paypalData.amount_type === 'variable' && paypalData.variable !== '' ) {
     7424                        paypalData.amount = self.get_field_calculation( paypalData.variable );
     7425                    }
     7426                },
     7427                createOrder: function(data, actions) {
     7428                    $form.addClass('forminator-partial-disabled');
     7429
     7430                    var nonce = $form.find('input[name="forminator_nonce"]').val(),
     7431                        form_id = self.getPayPalData('form_id'),
     7432                        request_data = self.paypal_request_data()
     7433                    ;
     7434                    return fetch( ForminatorFront.ajaxUrl + '?action=forminator_pp_create_order', {
     7435                        method: 'POST',
     7436                        mode: "same-origin",
     7437                        credentials: "same-origin",
     7438                        headers: {
     7439                            'content-type': 'application/json'
     7440                        },
     7441                        body: JSON.stringify({
     7442                            nonce: nonce,
     7443                            form_id: form_id,
     7444                            mode: self.getPayPalData('mode'),
     7445                            form_data: request_data,
     7446                            form_fields: $form.serialize()
     7447                        })
     7448                    }).then(function(res) {
     7449                        return res.json();
     7450                    }).then(function(response) {
     7451                        if ( response.success !== true ) {
     7452                            error_msg = response.data;
     7453
     7454                            return false;
     7455                        }
     7456
     7457                        var orderId = response.data.order_id;
     7458                        $form.find('.forminator-paypal-input').val( orderId );
     7459
     7460                        return orderId;
     7461                    });
     7462                },
     7463                onApprove: function(data, actions) {
     7464                    if( typeof self.settings.has_loader !== "undefined" && self.settings.has_loader ) {
     7465                        // Disable form fields
     7466                        $form.addClass('forminator-fields-disabled');
     7467
     7468                        $target_message.html('<p>' + self.settings.loader_label + '</p>');
     7469
     7470                        $target_message.removeAttr("aria-hidden")
     7471                            .prop("tabindex", "-1")
     7472                            .removeClass('forminator-success forminator-error')
     7473                            .addClass('forminator-loading forminator-show');
     7474
     7475                        self.focus_to_element($target_message);
     7476                    }
     7477
     7478                    $form.trigger('submit.frontSubmit');
     7479                },
     7480
     7481                onCancel: function (data, actions) {
     7482                    if( typeof self.settings.has_loader !== "undefined" && self.settings.has_loader ) {
     7483                        // Enable form fields
     7484                        $form.removeClass('forminator-fields-disabled forminator-partial-disabled');
     7485
     7486                        $target_message.removeClass('forminator-loading');
     7487                    }
     7488
     7489                    return actions.redirect();
     7490                },
     7491                onError: function () {
     7492                    if( typeof self.settings.has_loader !== "undefined" && self.settings.has_loader ) {
     7493                        // Enable form fields
     7494                        $form.removeClass('forminator-fields-disabled forminator-partial-disabled');
     7495
     7496                        $target_message.removeClass('forminator-loading');
     7497                    }
     7498
     7499                    $target_message.removeClass('forminator-accessible').addClass('forminator-error').html('').removeAttr( 'aria-hidden' );
     7500                    $target_message.html('<label class="forminator-label--error"><span>' + error_msg + '</span></label>');
     7501                    self.focus_to_element($target_message);
     7502                },
     7503            });
     7504            this.paypalButton.render( $form.find( '.forminator-button-paypal' )[0] );
     7505        },
     7506
     7507        configurePayPal: function () {
     7508            var self   = this,
     7509                paypalConfig = {
     7510                    form_id: this.getPayPalData('form_id'),
     7511                    sandbox_id: this.getPayPalData('sandbox_id'),
     7512                    currency: this.getPayPalData('currency'),
     7513                    live_id: this.getPayPalData('live_id'),
     7514                    amount: 0
     7515                };
     7516
     7517            paypalConfig.color = this.getPayPalData('color') ? this.getPayPalData('color') : 'gold';
     7518            paypalConfig.shape = this.getPayPalData('shape') ? this.getPayPalData('shape') : 'rect';
     7519            paypalConfig.label = this.getPayPalData('label') ? this.getPayPalData('label') : 'checkout';
     7520            paypalConfig.layout = this.getPayPalData('layout') ? this.getPayPalData('layout') : 'vertical';
     7521            paypalConfig.tagline = this.getPayPalData('tagline') ? this.getPayPalData('tagline') : 'true';
     7522            paypalConfig.redirect_url = this.getPayPalData('redirect_url') ? this.getPayPalData('redirect_url') : '';
     7523            paypalConfig.mode = this.getPayPalData('mode');
     7524            paypalConfig.locale = this.getPayPalData('locale') ? this.getPayPalData('locale') : 'en_US';
     7525            paypalConfig.debug_mode = this.getPayPalData('debug_mode') ? this.getPayPalData('debug_mode') : 'disable';
     7526            paypalConfig.amount_type = this.getPayPalData('amount_type') ? this.getPayPalData('amount_type') : 'fixed';
     7527            paypalConfig.variable = this.getPayPalData('variable') ? this.getPayPalData('variable') : '';
     7528            paypalConfig.height = this.getPayPalData('height') ? this.getPayPalData('height') : 55;
     7529            paypalConfig.shipping_address = this.getPayPalData('shipping_address') ? this.getPayPalData('shipping_address') : 55;
     7530
     7531            var amountType = this.getPayPalData('amount_type');
     7532            if (amountType === 'fixed') {
     7533                paypalConfig.amount = this.getPayPalData('amount');
     7534            } else if( amountType === 'variable' && paypalConfig.variable !== '' ) {
     7535                paypalConfig.amount =  this.get_field_calculation( paypalConfig.variable );
     7536            }
     7537
     7538
     7539            return paypalConfig;
     7540        },
     7541
     7542        getPayPalData: function (key) {
     7543            if (typeof this.paypalData[key] !== 'undefined') {
     7544                return this.paypalData[key];
     7545            }
     7546
     7547            return null;
     7548        },
     7549
     7550        // taken from forminatorFrontCondition
     7551        get_form_field: function ( element_id ) {
     7552            //find element by suffix -field on id input (default behavior)
     7553            var $element = this.$el.find('#' + element_id + '-field');
     7554            if ( $element.length === 0 ) {
     7555                //find element by its on name (for radio on singlevalue)
     7556                $element = this.$el.find('input[name=' + element_id + ']');
     7557                if ( $element.length === 0 ) {
     7558                    // for text area that have uniqid, so we check its name instead
     7559                    $element = this.$el.find('textarea[name=' + element_id + ']');
     7560                    if ( $element.length === 0 ) {
     7561                        //find element by its on name[] (for checkbox on multivalue)
     7562                        $element = this.$el.find('input[name="' + element_id + '[]"]');
     7563                        if ( $element.length === 0 ) {
     7564                            //find element by select name
     7565                            $element = this.$el.find('select[name="' + element_id + '"]');
     7566                            if ($element.length === 0) {
     7567                                //find element by direct id (for name field mostly)
     7568                                //will work for all field with element_id-[somestring]
     7569                                $element = this.$el.find('#' + element_id);
     7570                                if ( $element.length === 0 ) {
     7571                                    $element = this.$el.find('select[name=' + element_id + ']');
     7572                                }
     7573                            }
     7574                        }
     7575                    }
     7576                }
     7577            }
     7578
     7579            return $element;
     7580        },
     7581
     7582        get_field_calculation: function (element_id) {
     7583            var $element    = this.get_form_field(element_id);
     7584            var value       = 0;
     7585            var calculation = 0;
     7586            var checked     = null;
     7587
     7588            if (this.field_is_radio($element)) {
     7589                checked = $element.filter(":checked");
     7590                if (checked.length) {
     7591                    calculation = checked.data('calculation');
     7592                    if (calculation !== undefined) {
     7593                        value = Number(calculation);
     7594                    }
     7595                }
     7596            } else if (this.field_is_checkbox($element)) {
     7597                $element.each(function () {
     7598                    if ($(this).is(':checked')) {
     7599                        calculation = $(this).data('calculation');
     7600                        if (calculation !== undefined) {
     7601                            value += Number(calculation);
     7602                        }
     7603                    }
     7604                });
     7605
     7606            } else if (this.field_is_select($element)) {
     7607                checked = $element.find("option").filter(':selected');
     7608                if (checked.length) {
     7609                    calculation = checked.data('calculation');
     7610                    if (calculation !== undefined) {
     7611                        value = Number(calculation);
     7612                    }
     7613                }
     7614            } else {
     7615                if ( $element.inputmask ) {
     7616                    var unmaskVal = $element.inputmask('unmaskedvalue');
     7617                    value = unmaskVal.replace(/,/g, '.');
     7618                } else {
     7619                    value = Number( $element.val() );
     7620                }
     7621            }
     7622
     7623            return isNaN(value) ? 0 : value;
     7624        },
     7625
     7626        focus_to_element: function ($element) {
     7627            // force show in case its hidden of fadeOut
     7628            $element.show();
     7629            $('html,body').animate({scrollTop: ($element.offset().top - ($(window).height() - $element.outerHeight(true)) / 2)}, 500, function () {
     7630                if (!$element.attr("tabindex")) {
     7631                    $element.attr("tabindex", -1);
     7632                }
     7633                $element.focus();
     7634            });
     7635        },
     7636
     7637        paypal_request_data: function () {
     7638            var paypalData = this.configurePayPal(),
     7639                shipping_address = this.getPayPalData('shipping_address'),
     7640                billing_details = this.getPayPalData('billing-details'),
     7641                billingArr = this.getBillingData(),
     7642                paypal_data = {};
     7643            paypal_data.purchase_units = [{
     7644                amount: {
     7645                    currency_code: this.getPayPalData('currency'),
     7646                    value: paypalData.amount
     7647                }
     7648            }];
     7649            if ( 'disable' === shipping_address ) {
     7650                paypal_data.application_context = {
     7651                    shipping_preference: "NO_SHIPPING",
     7652                };
     7653            }
     7654            if ( billing_details ) {
     7655                paypal_data.payer = billingArr;
     7656            }
     7657
     7658            return paypal_data;
     7659        },
     7660
     7661        getBillingData: function () {
     7662            // Get billing fields
     7663            var billingName = this.getPayPalData( 'billing-name' ),
     7664                billingEmail = this.getPayPalData( 'billing-email' ),
     7665                billingAddress = this.getPayPalData( 'billing-address' );
     7666
     7667            // Create billing object
     7668            var billingObject = {}
     7669
     7670            if ( billingName ) {
     7671                billingObject.name = {};
     7672                var nameField = this.get_field_value( billingName );
     7673
     7674                // Check if Name field is multiple
     7675                if ( ! nameField ) {
     7676                    var pfix  = this.get_field_value( billingName + '-prefix' ) || '',
     7677                        fName = this.get_field_value( billingName + '-first-name' ) || '',
     7678                        mname = this.get_field_value( billingName + '-middle-name' ) || '',
     7679                        lName = this.get_field_value( billingName + '-last-name' ) || '';
     7680
     7681                    nameField = pfix ? pfix + ' ' : '';
     7682                    nameField += fName;
     7683                    nameField += mname ? ' ' + mname : '';
     7684                }
     7685
     7686                // Check if Name field is empty in the end, if not assign to the object
     7687                if ( nameField ) {
     7688                    billingObject.name.given_name = nameField;
     7689                    billingObject.name.surname = lName;
     7690                }
     7691            }
     7692
     7693            // Map email field
     7694            if( billingEmail ) {
     7695                var billingEmailValue = this.get_field_value( billingEmail ) || '';
     7696                if ( billingEmailValue ) {
     7697                    billingObject.email_address = billingEmailValue;
     7698                }
     7699            }
     7700            if ( billingAddress ) {
     7701                billingObject.address = {};
     7702                //  Map address line 1 field
     7703                var addressLine1 = this.get_field_value(billingAddress + '-street_address') || '';
     7704                if ( addressLine1 ) {
     7705                    billingObject.address.address_line_1 = addressLine1;
     7706                }
     7707
     7708                //Map address line 2 field
     7709                var addressLine2 = this.get_field_value(billingAddress + '-address_line') || '';
     7710                if ( addressLine2 ) {
     7711                    billingObject.address.address_line_2 = addressLine2;
     7712                }
     7713
     7714                // Map address city field
     7715                var addressCity = this.get_field_value(billingAddress + '-city') || '';
     7716                if ( addressCity ) {
     7717                    billingObject.address.admin_area_2 = addressCity;
     7718                }
     7719
     7720                // Map address state field
     7721                var addressState = this.get_field_value(billingAddress + '-state') || '';
     7722                if ( addressState ) {
     7723                    billingObject.address.admin_area_1 = addressState;
     7724                }
     7725
     7726                // Map address country field
     7727                var countryField = this.get_form_field(billingAddress + '-country') || '';
     7728                if ( countryField ) {
     7729                    billingObject.address.country_code = countryField.find(':selected').data('country-code');
     7730                }
     7731
     7732                // Map address country field
     7733                var addressZip = this.get_field_value(billingAddress + '-zip') || '';
     7734                if ( addressZip ) {
     7735                    billingObject.address.postal_code = addressZip;
     7736                }
     7737            }
     7738
     7739            return billingObject;
     7740        },
     7741
     7742        get_field_value: function ( element_id ) {
     7743            var $element = this.get_form_field( element_id );
     7744            var value    = '';
     7745            var checked  = null;
     7746
     7747            if ( this.field_is_radio( $element ) ) {
     7748                checked = $element.filter(":checked");
     7749                if ( checked.length ) {
     7750                    value = checked.val();
     7751                }
     7752            } else if ( this.field_is_checkbox( $element ) ) {
     7753                $element.each(function () {
     7754                    if ( $( this ).is(':checked') ) {
     7755                        value = $( this ).val();
     7756                    }
     7757                });
     7758
     7759            } else if ( this.field_is_select( $element ) ) {
     7760                value = $element.val();
     7761            } else {
     7762                value = $element.val()
     7763            }
     7764
     7765            return value;
     7766        },
     7767
     7768        field_is_radio: function ( $element ) {
     7769            var is_radio = false;
     7770            $element.each(function () {
     7771                if ( $(this).attr('type') === 'radio' ) {
     7772                    is_radio = true;
     7773                    //break
     7774                    return false;
     7775                }
     7776            });
     7777
     7778            return is_radio;
     7779        },
     7780
     7781        field_is_checkbox: function ( $element ) {
     7782            var is_checkbox = false;
     7783            $element.each(function () {
     7784                if ( $( this ).attr('type') === 'checkbox' ) {
     7785                    is_checkbox = true;
     7786                    //break
     7787                    return false;
     7788                }
     7789            });
     7790
     7791            return is_checkbox;
     7792        },
     7793
     7794        field_is_select: function ( $element ) {
     7795            return $element.is('select');
     7796        },
     7797
     7798        /*
     7799         * Replaces the currency in the paypal script url params
     7800         * so it will match the currency of another form with paypal checkout
     7801         */
     7802        replaceScriptCurrency: function () {
     7803            var self = this,
     7804                formCurrency = this.paypalData.currency;
     7805
     7806            self.$el.on( 'click', function( e ) {
     7807                var paypalScript = $( "script[src^='https://www.paypal.com/sdk/js']" ),
     7808                    paypalScriptSrc = paypalScript.attr( 'src' ),
     7809                    scriptCurrency = /currency=([^&]+)/.exec( paypalScriptSrc )[1];
     7810
     7811                if ( formCurrency === scriptCurrency ) {
     7812                    return;
     7813                }
     7814
     7815                paypalScript.attr( 'src', paypalScriptSrc.replace( 'currency='+ scriptCurrency, 'currency='+ formCurrency ) );
     7816                self.paypalButton.updateProps();
     7817            });
     7818        },
     7819
     7820    });
     7821
     7822    // A really lightweight plugin wrapper around the constructor,
     7823    // preventing against multiple instantiations
     7824    $.fn[pluginName] = function (options) {
     7825        return this.each(function () {
     7826            if (!$.data(this, pluginName)) {
     7827                $.data(this, pluginName, new ForminatorFrontPayPal(this, options));
     7828            }
     7829        });
     7830    };
     7831
     7832})(jQuery, window, document);
     7833
     7834
     7835// the semi-colon before function invocation is a safety net against concatenated
     7836// scripts and/or other plugins which may not be closed properly.
     7837;// noinspection JSUnusedLocalSymbols
     7838(function ($, window, document, undefined) {
     7839
     7840    "use strict";
     7841
     7842    // undefined is used here as the undefined global variable in ECMAScript 3 is
     7843    // mutable (ie. it can be changed by someone else). undefined isn't really being
     7844    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     7845    // can no longer be modified.
     7846
     7847    // window and document are passed through as local variables rather than global
     7848    // as this (slightly) quickens the resolution process and can be more efficiently
     7849    // minified (especially when both are regularly referenced in your plugin).
     7850
     7851    // Create the defaults once
     7852    var pluginName = "forminatorFrontDatePicker",
     7853        defaults = {};
     7854
     7855    // The actual plugin constructor
     7856    function ForminatorFrontDatePicker(element, options) {
     7857        this.element = element;
     7858        this.$el = $(this.element);
     7859
     7860        // jQuery has an extend method which merges the contents of two or
     7861        // more objects, storing the result in the first object. The first object
     7862        // is generally empty as we don't want to alter the default options for
     7863        // future instances of the plugin
     7864        this.settings = $.extend({}, defaults, options);
     7865        this._defaults = defaults;
     7866        this._name = pluginName;
     7867        this.init();
     7868    }
     7869
     7870    // Avoid Plugin.prototype conflicts
     7871    $.extend(ForminatorFrontDatePicker.prototype, {
     7872        init: function () {
     7873            var self = this,
     7874                dateFormat = this.$el.data('format'),
     7875                restrictType = this.$el.data('restrict-type'),
     7876                restrict = this.$el.data('restrict'),
     7877                restrictedDays = this.$el.data('restrict'),
     7878                minYear = this.$el.data('start-year'),
     7879                maxYear = this.$el.data('end-year'),
     7880                pastDates = this.$el.data('past-dates'),
     7881                dateValue = this.$el.val(),
     7882                startOfWeek = this.$el.data('start-of-week'),
     7883                minDate = this.$el.data('start-date'),
     7884                maxDate = this.$el.data('end-date'),
     7885                startField = this.$el.data('start-field'),
     7886                endField = this.$el.data('end-field'),
     7887                startOffset = this.$el.data('start-offset'),
     7888                endOffset = this.$el.data('end-offset'),
     7889                disableDate = this.$el.data('disable-date'),
     7890                disableRange = this.$el.data('disable-range');
     7891
     7892            //possible restrict only one
     7893            if (!isNaN(parseFloat(restrictedDays)) && isFinite(restrictedDays)) {
     7894                restrictedDays = [restrictedDays.toString()];
     7895            } else {
     7896                restrictedDays = restrict.split(',');
     7897            }
     7898            disableDate = disableDate.split(',');
     7899            disableRange = disableRange.split(',');
     7900
     7901            if (!minYear) {
     7902                minYear = "c-95";
     7903            }
     7904            if (!maxYear) {
     7905                maxYear = "c+95";
     7906            }
     7907            var disabledWeekDays = function ( current_date ) {
     7908                return self.restrict_date( restrictedDays, disableDate, disableRange, current_date );
     7909            };
     7910
     7911            var parent = this.$el.closest('.forminator-custom-form'),
     7912                add_class = "forminator-calendar";
     7913
     7914            if ( parent.hasClass('forminator-design--default') ) {
     7915                add_class = "forminator-calendar--default";
     7916            } else if ( parent.hasClass('forminator-design--material') ) {
     7917                add_class = "forminator-calendar--material";
     7918            } else if ( parent.hasClass('forminator-design--flat') ) {
     7919                add_class = "forminator-calendar--flat";
     7920            } else if ( parent.hasClass('forminator-design--bold') ) {
     7921                add_class = "forminator-calendar--bold";
     7922            }
     7923
     7924
     7925            this.$el.datepicker({
     7926                "beforeShow": function (input, inst) {
     7927                    // elementor popup
     7928                    var popup = $(this).closest('.elementor-popup-modal');
     7929
     7930                    // Remove all Hustle UI related classes
     7931                    ( inst.dpDiv ).removeClass( function( index, css ) {
     7932                        return ( css.match ( /\bhustle-\S+/g ) || []).join( ' ' );
     7933                    });
     7934
     7935                    // Remove all Forminator UI related classes
     7936                    ( inst.dpDiv ).removeClass( function( index, css ) {
     7937                        return ( css.match ( /\bforminator-\S+/g ) || []).join( ' ' );
     7938                    });
     7939                    ( inst.dpDiv ).addClass( 'forminator-custom-form-' + parent.data( 'form-id' ) + ' ' + add_class );
     7940                    // Enable/disable past dates
     7941                    if ( 'disable' === pastDates ) {
     7942                        $(this).datepicker( 'option', 'minDate', dateValue );
     7943                    } else {
     7944                        $(this).datepicker( 'option', 'minDate', null );
     7945                    }
     7946                    if( minDate ) {
     7947                        var min_date = new Date( minDate.replace(/-/g, '\/').replace(/T.+/, '') );
     7948                        $(this).datepicker( 'option', 'minDate', min_date );
     7949                    }
     7950                    if( maxDate ) {
     7951                        var max_date = new Date( maxDate.replace(/-/g, '\/').replace(/T.+/, '') );
     7952                        $(this).datepicker( 'option', 'maxDate', max_date );
     7953                    }
     7954                    if( startField ) {
     7955                        var startDateVal = self.getLimitDate( startField, startOffset );
     7956                        if( 'undefined' !== typeof startDateVal ) {
     7957                            $(this).datepicker( 'option', 'minDate', startDateVal );
     7958                        }
     7959                    }
     7960
     7961                    if( endField ) {
     7962                        var endDateVal = self.getLimitDate( endField, endOffset );
     7963                        if( 'undefined' !== typeof endDateVal ) {
     7964                            $(this).datepicker( 'option', 'maxDate', endDateVal );
     7965                        }
     7966                    }
     7967
     7968                    // if elementor popup append datepicker with input
     7969                    if( popup.length ) {
     7970                        popup.append($('#ui-datepicker-div'));
     7971                        var rect = input.getBoundingClientRect();
     7972                        setTimeout(function() {
     7973                            inst.dpDiv.css({
     7974                                top: rect.top + rect.height,
     7975                                left: rect.left
     7976                            });
     7977                        }, 0);
     7978                    } else {
     7979                        $('body').append($('#ui-datepicker-div'));
     7980                    }
     7981                },
     7982                "beforeShowDay": disabledWeekDays,
     7983                "monthNames": datepickerLang.monthNames,
     7984                "monthNamesShort": datepickerLang.monthNamesShort,
     7985                "dayNames": datepickerLang.dayNames,
     7986                "dayNamesShort": datepickerLang.dayNamesShort,
     7987                "dayNamesMin": datepickerLang.dayNamesMin,
     7988                "changeMonth": true,
     7989                "changeYear": true,
     7990                "dateFormat": dateFormat,
     7991                "yearRange": minYear + ":" + maxYear,
     7992                "minDate": new Date(minYear, 0, 1),
     7993                "maxDate": new Date(maxYear, 11, 31),
     7994                "firstDay" : startOfWeek,
     7995                "onClose": function () {
     7996                    //Called when the datepicker is closed, whether or not a date is selected
     7997                    $(this).valid();
     7998                },
     7999            });
     8000
     8001            //Disables google translator for the datepicker - this prevented that when selecting the date the result is presented as follows: NaN/NaN/NaN
     8002            $('.ui-datepicker').addClass('notranslate');
     8003        },
     8004
     8005        getLimitDate: function ( dependentField, offset ) {
     8006            var fieldVal = $('input[name ="'+ dependentField + '"]').val();
     8007            if( typeof fieldVal !== 'undefined' ) {
     8008                var DateFormat = $('input[name ="'+ dependentField + '"]').data('format').replace(/y/g, 'yy'),
     8009                    sdata = offset.split('_'),
     8010                    newDate = moment( fieldVal, DateFormat.toUpperCase() );
     8011                if( '-' === sdata[0] ) {
     8012                    newDate = newDate.subtract( sdata[1], sdata[2] );
     8013                } else {
     8014                    newDate = newDate.add( sdata[1], sdata[2] );
     8015                }
     8016                var formatedDate = moment( newDate ).format( 'YYYY-MM-DD' ),
     8017                    dateVal = new Date( formatedDate );
     8018
     8019                return dateVal;
     8020            }
     8021        },
     8022
     8023        restrict_date: function ( restrictedDays, disableDate, disableRange, date ) {
     8024            var hasRange = true,
     8025                day = date.getDay(),
     8026                date_string = jQuery.datepicker.formatDate('mm/dd/yy', date);
     8027
     8028            if ( 0 !== disableRange[0].length ) {
     8029                for ( var i = 0; i < disableRange.length; i++ ) {
     8030
     8031                    var disable_date_range = disableRange[i].split("-"),
     8032                        start_date = new Date( disable_date_range[0].trim() ),
     8033                        end_date = new Date( disable_date_range[1].trim() );
     8034                    if ( date >= start_date && date <= end_date ) {
     8035                        hasRange = false;
     8036                        break;
     8037                    }
     8038                }
     8039            }
     8040
     8041            if ( -1 !== restrictedDays.indexOf( day.toString() ) ||
     8042                -1 !== disableDate.indexOf( date_string ) ||
     8043                false === hasRange
     8044            ) {
     8045                return [false, "disabledDate"]
     8046            } else {
     8047                return [true, "enabledDate"]
     8048            }
     8049        },
     8050    });
     8051
     8052    // A really lightweight plugin wrapper around the constructor,
     8053    // preventing against multiple instantiations
     8054    $.fn[pluginName] = function (options) {
     8055        return this.each(function () {
     8056            if (!$.data(this, pluginName)) {
     8057                $.data(this, pluginName, new ForminatorFrontDatePicker(this, options));
     8058            }
     8059        });
     8060    };
     8061})(jQuery, window, document);
     8062// the semi-colon before function invocation is a safety net against concatenated
     8063// scripts and/or other plugins which may not be closed properly.
     8064;// noinspection JSUnusedLocalSymbols
     8065(function ($, window, document, undefined) {
     8066
     8067    "use strict";
     8068
     8069    // undefined is used here as the undefined global variable in ECMAScript 3 is
     8070    // mutable (ie. it can be changed by someone else). undefined isn't really being
     8071    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     8072    // can no longer be modified.
     8073
     8074    // window and document are passed through as local variables rather than global
     8075    // as this (slightly) quickens the resolution process and can be more efficiently
     8076    // minified (especially when both are regularly referenced in your plugin).
     8077
     8078    // Create the defaults once
     8079    var pluginName = "forminatorFrontValidate",
     8080        ownMethods = {},
     8081        defaults   = {
     8082            rules: {},
     8083            messages: {}
     8084        };
     8085
     8086    // The actual plugin constructor
     8087    function ForminatorFrontValidate(element, options) {
     8088        this.element = element;
     8089        this.$el     = $(this.element);
     8090
     8091        // jQuery has an extend method which merges the contents of two or
     8092        // more objects, storing the result in the first object. The first object
     8093        // is generally empty as we don't want to alter the default options for
     8094        // future instances of the plugin
     8095        this.settings  = $.extend({}, defaults, options);
     8096        this._defaults = defaults;
     8097        this._name     = pluginName;
     8098        this.init();
     8099    }
     8100
     8101    // Avoid Plugin.prototype conflicts
     8102    $.extend( ForminatorFrontValidate.prototype, {
     8103
     8104        init: function () {
     8105            $( '.forminator-select2' ).on('change', this.element, function (e, param1) {
     8106                if ( 'forminator_emulate_trigger' !== param1 ) {
     8107                    $( this ).trigger('focusout');
     8108                }
     8109            });
     8110
     8111            var self      = this;
     8112            var submitted = false;
     8113            var $form     = this.$el;
     8114            var rules     = self.settings.rules;
     8115            var messages  = self.settings.messages;
     8116
     8117            // Duplicate rules for new repeated Group fields.
     8118            if ( $form.hasClass( 'forminator-grouped-fields' ) ) {
     8119                let suffix = $form.data( 'suffix' );
     8120                $.each( rules, function ( key, val ) {
     8121                    // Separate keys with [] at the end.
     8122                    const newKey = key.replace( /(.+?)(\[\])?$/g, '$1' + '-' + suffix + '$2' );
     8123                    if ( ! $form.find( '[name="' + newKey + '"]' ).length && ! $form.find( '#' + newKey.replace( '[]', '' ) ).length ) {
     8124                        return;
     8125                    }
     8126                    rules[ newKey ] = val;
     8127                    messages[ newKey ] = messages[ key ];
     8128                } );
     8129                $form = $form.closest( 'form.forminator-ui' );
     8130            }
     8131
     8132            $form.data('validator', null).unbind('validate').validate({
     8133
     8134                // add support for hidden required fields (uploads, wp_editor) when required
     8135                ignore: ":hidden:not(.do-validate)",
     8136
     8137                errorPlacement: function (error, element) {
     8138                    $form.trigger('validation:error');
     8139                },
     8140
     8141                showErrors: function(errorMap, errorList) {
     8142
     8143                    if( submitted && errorList.length > 0 ) {
     8144
     8145                        $form.find( '.forminator-response-message' ).html( '<ul></ul>' );
     8146
     8147                        jQuery.each( errorList, function( key, error ) {
     8148                            $form.find( '.forminator-response-message ul' ).append( '<li>' + error.message + '</li>' );
     8149                        });
     8150
     8151                        $form.find( '.forminator-response-message' )
     8152                            .removeAttr( 'aria-hidden' )
     8153                            .prop( 'tabindex', '-1' )
     8154                            .addClass( 'forminator-accessible' )
     8155                            ;
     8156                    }
     8157
     8158                    submitted = false;
     8159
     8160                    this.defaultShowErrors();
     8161
     8162                    $form.trigger('validation:showError', errorList);
     8163                },
     8164
     8165                invalidHandler: function(form, validator){
     8166                    submitted = true;
     8167                    $form.trigger('validation:invalid');
     8168                },
     8169
     8170                onfocusout: function ( element ) {
     8171
     8172                    //datepicker will be validated when its closed
     8173                    if ( $( element ).hasClass('hasDatepicker') === false ) {
     8174                        $( element ).valid();
     8175                    }
     8176                    $( element ).trigger('validation:focusout');
     8177                },
     8178
     8179                highlight: function (element, errorClass, message) {
     8180
     8181                    var holder      = $( element );
     8182                    var holderField = holder.closest( '.forminator-field' );
     8183                    var holderDate  = holder.closest( '.forminator-date-input' );
     8184                    var holderTime  = holder.closest( '.forminator-timepicker' );
     8185                    var holderError = '';
     8186                    var getColumn   = false;
     8187                    var getError    = false;
     8188                    var getDesc     = false;
     8189
     8190                    var errorMessage    = this.errorMap[element.name];
     8191                    var errorId         = holder.attr('id') + '-error';
     8192                    var ariaDescribedby = holder.attr('aria-describedby');
     8193                    var errorMarkup     = '<span class="forminator-error-message" id="'+ errorId +'"></span>';
     8194
     8195                    if ( holderDate.length > 0 ) {
     8196
     8197                        getColumn = holderDate.parent();
     8198                        getError  = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     8199                        getDesc   = getColumn.find( '.forminator-description' );
     8200
     8201                        errorMarkup = '<span class="forminator-error-message" data-error-field="' + holder.data( 'field' ) + '" id="'+ errorId +'"></span>';
     8202
     8203                        if ( 0 === getError.length ) {
     8204
     8205                            if ( 'day' === holder.data( 'field' ) ) {
     8206
     8207                                if ( getColumn.find( '.forminator-error-message[data-error-field="year"]' ).length ) {
     8208
     8209                                    $( errorMarkup ).insertBefore( getColumn.find( '.forminator-error-message[data-error-field="year"]' ) );
     8210
     8211                                } else {
     8212
     8213                                    if ( 0 === getDesc.length ) {
     8214                                        getColumn.append( errorMarkup );
     8215                                    } else {
     8216                                        $( errorMarkup ).insertBefore( getDesc );
     8217                                    }
     8218                                }
     8219
     8220                                if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     8221
     8222                                    holderField.append(
     8223                                        '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     8224                                    );
     8225                                }
     8226                            }
     8227
     8228                            if ( 'month' === holder.data( 'field' ) ) {
     8229
     8230                                if ( getColumn.find( '.forminator-error-message[data-error-field="day"]' ).length ) {
     8231
     8232                                    $( errorMarkup ).insertBefore(
     8233                                        getColumn.find( '.forminator-error-message[data-error-field="day"]' )
     8234                                    );
     8235
     8236                                } else {
     8237
     8238                                    if ( 0 === getDesc.length ) {
     8239                                        getColumn.append( errorMarkup );
     8240                                    } else {
     8241                                        $( errorMarkup ).insertBefore( getDesc );
     8242                                    }
     8243                                }
     8244
     8245                                if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     8246
     8247                                    holderField.append(
     8248                                        '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     8249                                    );
     8250                                }
     8251                            }
     8252
     8253                            if ( 'year' === holder.data( 'field' ) ) {
     8254
     8255                                if ( 0 === getDesc.length ) {
     8256                                    getColumn.append( errorMarkup );
     8257                                } else {
     8258                                    $( errorMarkup ).insertBefore( getDesc );
     8259                                }
     8260
     8261                                if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     8262
     8263                                    holderField.append(
     8264                                        '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     8265                                    );
     8266                                }
     8267                            }
     8268                        }
     8269
     8270                        holderError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     8271
     8272                        // Insert error message
     8273                        holderError.html( errorMessage );
     8274                        holderField.find( '.forminator-error-message' ).html( errorMessage );
     8275
     8276                    } else if ( holderTime.length > 0 ) {
     8277
     8278                        getColumn = holderTime.parent();
     8279                        getError  = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     8280                        getDesc   = getColumn.find( '.forminator-description' );
     8281
     8282                        errorMarkup = '<span class="forminator-error-message" data-error-field="' + holder.data( 'field' ) + '" id="'+ errorId +'"></span>';
     8283
     8284                        if ( 0 === getError.length ) {
     8285
     8286                            if ( 'hours' === holder.data( 'field' ) ) {
     8287
     8288                                if ( getColumn.find( '.forminator-error-message[data-error-field="minutes"]' ).length ) {
     8289
     8290                                    $( errorMarkup ).insertBefore(
     8291                                        getColumn.find( '.forminator-error-message[data-error-field="minutes"]' )
     8292                                    );
     8293                                } else {
     8294
     8295                                    if ( 0 === getDesc.length ) {
     8296                                        getColumn.append( errorMarkup );
     8297                                    } else {
     8298                                        $( errorMarkup ).insertBefore( getDesc );
     8299                                    }
     8300                                }
     8301
     8302                                if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     8303
     8304                                    holderField.append(
     8305                                        '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     8306                                    );
     8307                                }
     8308                            }
     8309
     8310                            if ( 'minutes' === holder.data( 'field' ) ) {
     8311
     8312                                if ( 0 === getDesc.length ) {
     8313                                    getColumn.append( errorMarkup );
     8314                                } else {
     8315                                    $( errorMarkup ).insertBefore( getDesc );
     8316                                }
     8317
     8318                                if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     8319
     8320                                    holderField.append(
     8321                                        '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     8322                                    );
     8323                                }
     8324                            }
     8325                        }
     8326
     8327                        holderError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     8328
     8329                        // Insert error message
     8330                        holderError.html( errorMessage );
     8331                        holderField.find( '.forminator-error-message' ).html( errorMessage );
     8332
     8333                    } else {
     8334
     8335                        var getError = holderField.find( '.forminator-error-message' );
     8336                        var getDesc  = holderField.find( '.forminator-description' );
     8337
     8338                        if ( 0 === getError.length ) {
     8339
     8340                            if ( 0 === getDesc.length ) {
     8341                                holderField.append( errorMarkup );
     8342                            } else {
     8343                                $( errorMarkup ).insertBefore( getDesc );
     8344                            }
     8345                        }
     8346
     8347                        holderError = holderField.find( '.forminator-error-message' );
     8348
     8349                        // Insert error message
     8350                        holderError.html( errorMessage );
     8351
     8352                    }
     8353
     8354                    // Field aria describedby for screen readers
     8355                    if (ariaDescribedby) {
     8356                        var ids = ariaDescribedby.split(' ');
     8357                        var errorIdExists = ids.includes(errorId);
     8358                        if (!errorIdExists) {
     8359                          ids.push(errorId);
     8360                        }
     8361                        var updatedAriaDescribedby = ids.join(' ');
     8362                        holder.attr('aria-describedby', updatedAriaDescribedby);
     8363                    } else {
     8364                        holder.attr('aria-describedby', errorId);
     8365                    }
     8366
     8367                    // Field invalid status for screen readers
     8368                    holder.attr( 'aria-invalid', 'true' );
     8369
     8370                    // Field error status
     8371                    holderField.addClass( 'forminator-has_error' );
     8372                    holder.trigger('validation:highlight');
     8373
     8374                },
     8375
     8376                unhighlight: function (element, errorClass, validClass) {
     8377
     8378                    var holder      = $( element );
     8379                    var holderField = holder.closest( '.forminator-field' );
     8380                    var holderTime  = holder.closest( '.forminator-timepicker' );
     8381                    var holderDate  = holder.closest( '.forminator-date-input' );
     8382                    var holderError = '';
     8383
     8384                    var errorId = holder.attr('id') + '-error';
     8385                    var ariaDescribedby = holder.attr('aria-describedby');
     8386
     8387                    if ( holderDate.length > 0 ) {
     8388                        holderError = holderDate.parent().find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     8389                    } else if ( holderTime.length > 0 ) {
     8390                        holderError = holderTime.parent().find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     8391                    } else {
     8392                        holderError = holderField.find( '.forminator-error-message' );
     8393                    }
     8394
     8395                    // Remove or Update describedby attribute for screen readers
     8396                    if (ariaDescribedby) {
     8397                        var ids = ariaDescribedby.split(' ');
     8398                        ids = ids.filter(function (id) {
     8399                            return id !== errorId;
     8400                        });
     8401                        var updatedAriaDescribedby = ids.join(' ');
     8402                        holder.attr('aria-describedby', updatedAriaDescribedby);
     8403                    } else {
     8404                        holder.removeAttr('aria-describedby');
     8405                    }
     8406
     8407                    // Remove invalid attribute for screen readers
     8408                    holder.removeAttr( 'aria-invalid' );
     8409
     8410                    // Remove error message
     8411                    holderError.remove();
     8412
     8413                    // Remove error class
     8414                    holderField.removeClass( 'forminator-has_error' );
     8415                    holder.trigger('validation:unhighlight');
     8416
     8417                },
     8418
     8419                rules: rules,
     8420
     8421                messages: messages
     8422
     8423            });
     8424
     8425            $form.off('forminator.validate.signature').on('forminator.validate.signature', function () {
     8426                //validator.element( $( this ).find( "input[id$='_data']" ) );
     8427                var validator = $( this ).validate();
     8428                validator.form();
     8429            });
     8430
     8431            // Trigger change for the hour field.
     8432            $( '.time-minutes.has-time-limiter, .time-ampm.has-time-limiter' ).on( 'change', function () {
     8433                var hourContainer = $( this ).closest( '.forminator-col' ).siblings( '.forminator-col' ).first();
     8434                hourContainer.find( '.time-hours' ).trigger( 'focusout' );
     8435            });
     8436
     8437            // Trigger change for the required checkbox field.
     8438            $( '.forminator-field.required input[type="checkbox"]' ).on( 'input', function () {
     8439                $( this ).not( ':checked' ).trigger( 'focusout' );
     8440            });
     8441        }
     8442    });
     8443
     8444    // A really lightweight plugin wrapper around the constructor,
     8445    // preventing against multiple instantiations
     8446    $.fn[pluginName] = function (options) {
     8447        // We need to restore our custom validation methods in case they were
     8448        // lost or overwritten by another instantiation of the jquery.Validate plugin.
     8449        $.each( ownMethods, function( key, method ) {
     8450            if ( undefined === $.validator.methods[ key ] ) {
     8451                $.validator.addMethod( key, method );
     8452            } else if ( key === 'number' ) {
     8453                $.validator.methods.number = ownMethods.number;
     8454            }
     8455        });
     8456        return this.each(function () {
     8457            if (!$.data(this, pluginName)) {
     8458                $.data(this, pluginName, new ForminatorFrontValidate(this, options));
     8459            }
     8460        });
     8461    };
     8462    $.validator.addMethod("validurl", function (value, element) {
     8463        var url = $.validator.methods.url.bind(this);
     8464        return url(value, element) || url('http://' + value, element);
     8465    });
     8466    $.validator.addMethod("forminatorPhoneNational", function ( value, element ) {
     8467        var phone = $( element );
     8468        if ( !phone.data('required') && value === '+' +phone.intlTelInput( 'getSelectedCountryData' ).dialCode ) {
     8469            return true;
     8470        }
     8471
     8472        if (
     8473            'undefined' !== typeof phone.data( 'country' ) &&
     8474            phone.data( 'country' ).toLowerCase() !== phone.intlTelInput( 'getSelectedCountryData' ).iso2
     8475        ) {
     8476            return false;
     8477        }
     8478
     8479        // Uses intlTelInput to check if the number is valid.
     8480        return this.optional( element ) || phone.intlTelInput( 'isValidNumber' );
     8481    });
     8482    $.validator.addMethod("forminatorPhoneInternational", function (value, element) {
     8483        // check whether phone field is international and optional
     8484        if ( !$(element).data('required') && value === '+' +$(element).intlTelInput( 'getSelectedCountryData' ).dialCode + ' ' ) {
     8485            return true;
     8486        }
     8487
     8488        // Uses intlTelInput to check if the number is valid.
     8489        return this.optional(element) || $(element).intlTelInput('isValidNumber');
     8490    });
     8491    $.validator.addMethod("dateformat", function (value, element, param) {
     8492        // dateITA method from jQuery Validator additional. Date method is deprecated and doesn't work for all formats
     8493        var check = false,
     8494            re    = 'yy-mm-dd' === param ||
     8495                    'yy/mm/dd' === param ||
     8496                    'yy.mm.dd' === param
     8497                ? /^\d{4}-\d{1,2}-\d{1,2}$/ : /^\d{1,2}-\d{1,2}-\d{4}$/,
     8498            adata, gg, mm, aaaa, xdata;
     8499        value = value.replace(/[ /.]/g, '-');
     8500        if (re.test(value)) {
     8501            if ('dd/mm/yy' === param || 'dd-mm-yy' === param || 'dd.mm.yy' === param) {
     8502                adata = value.split("-");
     8503                gg    = parseInt(adata[0], 10);
     8504                mm    = parseInt(adata[1], 10);
     8505                aaaa  = parseInt(adata[2], 10);
     8506            } else if ('mm/dd/yy' === param || 'mm.dd.yy' === param || 'mm-dd-yy' === param) {
     8507                adata = value.split("-");
     8508                mm    = parseInt(adata[0], 10);
     8509                gg    = parseInt(adata[1], 10);
     8510                aaaa  = parseInt(adata[2], 10);
     8511            } else {
     8512                adata = value.split("-");
     8513                aaaa  = parseInt(adata[0], 10);
     8514                mm    = parseInt(adata[1], 10);
     8515                gg    = parseInt(adata[2], 10);
     8516            }
     8517            xdata = new Date(Date.UTC(aaaa, mm - 1, gg, 12, 0, 0, 0));
     8518            if ((xdata.getUTCFullYear() === aaaa) && (xdata.getUTCMonth() === mm - 1) && (xdata.getUTCDate() === gg)) {
     8519                check = true;
     8520            } else {
     8521                check = false;
     8522            }
     8523        } else {
     8524            check = false;
     8525        }
     8526        return this.optional(element) || check;
     8527    });
     8528    $.validator.addMethod("maxwords", function (value, element, param) {
     8529        return this.optional(element) || value.trim().split(/\s+/).length <= param;
     8530    });
     8531    // override core jquertvalidation maxlength. Ignore tags.
     8532    $.validator.methods.maxlength = function ( value, element, length ) {
     8533        value = value.replace( /<[^>]*>/g, '' );
     8534
     8535        if ( value.length > length ) {
     8536            return false;
     8537        }
     8538
     8539        return true;
     8540    };
     8541    $.validator.addMethod("trim", function( value, element, param ) {
     8542        return true === this.optional( element ) || 0 !== value.trim().length;
     8543    });
     8544    $.validator.addMethod("emailWP", function (value, element, param) {
     8545        if (this.optional(element)) {
     8546            return true;
     8547        }
     8548
     8549        // Test for the minimum length the email can be
     8550        if (value.trim().length < 6) {
     8551            return false;
     8552        }
     8553
     8554        // Test for an @ character after the first position
     8555        if (value.indexOf('@', 1) < 0) {
     8556            return false;
     8557        }
     8558
     8559        // Split out the local and domain parts
     8560        var parts = value.split('@', 2);
     8561
     8562        // LOCAL PART
     8563        // Test for invalid characters
     8564        if (!parts[0].match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~\.-]+$/)) {
     8565            return false;
     8566        }
     8567
     8568        // DOMAIN PART
     8569        // Test for sequences of periods
     8570        if (parts[1].match(/\.{2,}/)) {
     8571            return false;
     8572        }
     8573
     8574        var domain = parts[1];
     8575        // Split the domain into subs
     8576        var subs   = domain.split('.');
     8577        if (subs.length < 2) {
     8578            return false;
     8579        }
     8580
     8581        var subsLen = subs.length;
     8582        for (var i = 0; i < subsLen; i++) {
     8583            // Test for invalid characters
     8584            if (!subs[i].match(/^[a-z0-9-]+$/i)) {
     8585                return false;
     8586            }
     8587        }
     8588
     8589        return true;
     8590    });
     8591    $.validator.addMethod("forminatorPasswordStrength", function (value, element, param) {
     8592        var passwordStrength = value.trim();
     8593
     8594        // Password is optional and is empty so don't check strength.
     8595        if ( passwordStrength.length == 0 ) {
     8596            return true;
     8597        }
     8598
     8599        //at least 8 characters
     8600        if ( ! passwordStrength || passwordStrength.length < 8) {
     8601            return false;
     8602        }
     8603
     8604        var symbolSize = 0, natLog, score;
     8605        //at least one number
     8606        if ( passwordStrength.match(/[0-9]/) ) {
     8607            symbolSize += 10;
     8608        }
     8609        //at least one lowercase letter
     8610        if ( passwordStrength.match(/[a-z]/) ) {
     8611            symbolSize += 20;
     8612        }
     8613        //at least one uppercase letter
     8614        if ( passwordStrength.match(/[A-Z]/) ) {
     8615            symbolSize += 20;
     8616        }
     8617        if ( passwordStrength.match(/[^a-zA-Z0-9]/) ) {
     8618            symbolSize += 30;
     8619        }
     8620        //at least one special character
     8621        if ( passwordStrength.match(/[=!\-@.,_*#&?^`%$+\/{\[\]|}^?~]/) ) {
     8622            symbolSize += 30;
     8623        }
     8624
     8625        natLog = Math.log( Math.pow(symbolSize, passwordStrength.length) );
     8626        score = natLog / Math.LN2;
     8627
     8628        return score >= 54;
     8629    });
     8630
     8631    $.validator.addMethod("extension", function (value, element, param) {
     8632        var check = false;
     8633        if (value.trim() !== '') {
     8634            var extension = value.replace(/^.*\./, '');
     8635            if (extension == value) {
     8636                extension = 'notExt';
     8637            } else {
     8638                extension = extension.toLowerCase();
     8639            }
     8640
     8641            if (param.indexOf(extension) != -1) {
     8642                check = true;
     8643            }
     8644        }
     8645
     8646        return this.optional(element) || check;
     8647    });
     8648
     8649    // $.validator.methods.required = function(value, element, param) {
     8650    //  console.log("required", element);
     8651    //
     8652    //  return someCondition && value != null;
     8653    // }
     8654
     8655    // override core jquertvalidation number, to use HTML5 spec
     8656    $.validator.methods.number = function (value, element, param) {
     8657        return this.optional(element) || /^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/.test(value);
     8658    };
     8659
     8660    $.validator.addMethod('minNumber', function (value, el, param) {
     8661        if ( 0 === value.length ) {
     8662            return true;
     8663        }
     8664        var minVal = parseFloatFromString( value );
     8665        return minVal >= param;
     8666    });
     8667    $.validator.addMethod('maxNumber', function (value, el, param) {
     8668        if ( 0 === value.length ) {
     8669            return true;
     8670        }
     8671        var maxVal = parseFloatFromString( value );
     8672        return maxVal <= param;
     8673    });
     8674    $.validator.addMethod( 'timeLimit', function ( value, el, limit ) {
     8675        var chosenTime = forminatorGetTime( el, value ),
     8676            startLimit = forminatorConvertToSeconds( limit.start_limit ),
     8677            endLimit   = forminatorConvertToSeconds( limit.end_limit ),
     8678            comparison = chosenTime >= startLimit && chosenTime <= endLimit,
     8679            hoursDiv   = $( el ).closest( '.forminator-col' ),
     8680            minutesField = hoursDiv.next().find( '.forminator-field' )
     8681            ;
     8682
     8683        // Lets add error class to minutes field if hours has error.
     8684        if ( ! comparison && true !== chosenTime ) {
     8685            setTimeout(
     8686                function() {
     8687                    minutesField.addClass( 'forminator-has_error' );
     8688                },
     8689                10
     8690            );
     8691        } else {
     8692            minutesField.removeClass( 'forminator-has_error' );
     8693        }
     8694
     8695        // Check if chosenTime is not true, then compare if chosenTime in seconds is >= to the limit in seconds.
     8696        return true !== chosenTime ? comparison: true;
     8697    });
     8698
     8699    function parseFloatFromString( value ) {
     8700        value = String( value ).trim();
     8701
     8702        var parsed = parseFloat( value );
     8703        if ( String( parsed ) === value ) {
     8704            return fixDecimals( parsed, 2 );
     8705        }
     8706
     8707        var split = value.split( /[^\dE-]+/ );
     8708
     8709        if ( 1 === split.length ) {
     8710            return fixDecimals(parseFloat(value), 2);
     8711        }
     8712
     8713        var decimal = split.pop();
     8714
     8715        // reconstruct the number using dot as decimal separator
     8716        return fixDecimals( parseFloat( split.join('') +  '.' + decimal ), 2 );
     8717    }
     8718
     8719    function fixDecimals( num, precision ) {
     8720        return ( Math.floor( num * 100 ) / 100 ).toFixed( precision );
     8721    }
     8722
     8723    function forminatorGetTime ( el, value ) {
     8724        var hoursDiv, minutesDiv, hours, minutes, meridiem, final = '';
     8725
     8726        // Get the values minutes and meridiem.
     8727        if ( el.name.includes( 'hours' ) ) {
     8728            hoursDiv = $( el ).closest( '.forminator-col' );
     8729            hours = value;
     8730            minutesDiv = hoursDiv.next();
     8731            minutes = minutesDiv.find( '.time-minutes' );
     8732
     8733            if ( 'select' === minutes.prop( 'tagName' ).toLowerCase() ) {
     8734                minutes = minutesDiv.find( '.time-minutes option:selected' ).val();
     8735            } else {
     8736                minutes = minutesDiv.find( '.time-minutes' ).val();
     8737            }
     8738
     8739            meridiem = minutesDiv.next().find( 'select[name$="ampm"] option:selected' ).val();
     8740        }
     8741
     8742        if (
     8743            'undefined' !== typeof hours && '' !== hours &&
     8744            'undefined' !== typeof minutes && '' !== minutes
     8745        ) {
     8746            final = hours + ':' + minutes;
     8747        } else {
     8748            return true;
     8749        }
     8750
     8751        if ( '' !== final && 'undefined' !== typeof meridiem ) {
     8752            final += ' ' + meridiem;
     8753        }
     8754
     8755        final = forminatorConvertToSeconds( final );
     8756
     8757        return final;
     8758    }
     8759
     8760    function forminatorConvertToSeconds ( chosenTime ) {
     8761        var [ time, modifier ] = chosenTime.split(' ');
     8762        var [ hours, minutes ] = time.split(':');
     8763
     8764        if ( 'undefined' !== typeof modifier ) {
     8765            if ( 12 === parseInt( hours, 10 ) ) {
     8766                hours = 0;
     8767            }
     8768            if ( 'pm' === modifier.toLowerCase() ) {
     8769                hours = parseInt( hours, 10 ) + 12;
     8770            }
     8771        }
     8772
     8773        hours   = hours * 60 * 60;
     8774        minutes = minutes * 60;
     8775
     8776        return hours + minutes;
     8777    }
     8778
     8779    // Backup the recently added custom validation methods (they will be
     8780    // checked in the plugin wrapper later)
     8781    ownMethods = $.validator.methods;
     8782
     8783})(jQuery, window, document);
     8784// the semi-colon before function invocation is a safety net against concatenated
     8785// scripts and/or other plugins which may not be closed properly.
     8786;// noinspection JSUnusedLocalSymbols
     8787(function ($, window, document, undefined) {
     8788
     8789    "use strict";
     8790
     8791    // undefined is used here as the undefined global variable in ECMAScript 3 is
     8792    // mutable (ie. it can be changed by someone else). undefined isn't really being
     8793    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     8794    // can no longer be modified.
     8795
     8796    // window and document are passed through as local variables rather than global
     8797    // as this (slightly) quickens the resolution process and can be more efficiently
     8798    // minified (especially when both are regularly referenced in your plugin).
     8799
     8800    window.paypalHasCondition = [];
     8801
     8802    // Create the defaults once
     8803    var pluginName = "forminatorFrontCondition",
     8804        defaults = {
     8805            fields: {},
     8806            relations: {}
     8807        };
     8808
     8809    // The actual plugin constructor
     8810    function ForminatorFrontCondition(element, options, calendar) {
     8811        this.element = element;
     8812        this.$el = $(this.element);
     8813
     8814        // jQuery has an extend method which merges the contents of two or
     8815        // more objects, storing the result in the first object. The first object
     8816        // is generally empty as we don't want to alter the default options for
     8817        // future instances of the plugin
     8818        this.settings = $.extend({}, defaults, options);
     8819        this._defaults = defaults;
     8820        this._name = pluginName;
     8821        this.calendar = calendar[0];
     8822        this.init();
     8823    }
     8824    // Avoid Plugin.prototype conflicts
     8825    $.extend(ForminatorFrontCondition.prototype, {
     8826        init: function () {
     8827            var self = this,
     8828                form = this.$el,
     8829                $forminatorFields = this.$el.find( ".forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea, .forminator-field-signature")
     8830                ;
     8831
     8832            // Duplicate rules for new repeated Group fields.
     8833            if ( form.hasClass( 'forminator-grouped-fields' ) ) {
     8834                let suffix = form.data( 'suffix' );
     8835                $.each( this.settings.fields, function ( key, val ) {
     8836                    let newKey = key + '-' + suffix;
     8837                    if ( ! form.find( '[name="' + newKey + '"]' ).length && ! form.find( '#' + newKey ).length ) {
     8838                        return;
     8839                    }
     8840                    let newVal = self.updateConditions( val, suffix, form );
     8841                    self.settings['fields'][ newKey ] = newVal;
     8842                } );
     8843            }
     8844
     8845            this.add_missing_relations();
     8846
     8847            $forminatorFields.on( 'change input forminator.change', function (e) {
     8848                var $element = $(this),
     8849                    element_id = $element.closest('.forminator-col').attr('id')
     8850                    ;
     8851                if ( $element.is( 'input[type="radio"]' ) && 'input' === e.type ) {
     8852                    // Skip input events for radio buttons, handle only change events for them.
     8853                    return;
     8854                }
     8855
     8856                if (typeof element_id === 'undefined' || 0 === element_id.indexOf( 'slider-' ) ) {
     8857                    /*
     8858                     * data-multi attribute was added to Name field - multiple
     8859                     * We had to use name attribute for Name multi-field because we cannot change
     8860                     * the IDs of elements. Some functions rely on the ID text pattern already.
     8861                     */
     8862                    if ( $element.attr( 'data-multi' ) === '1' || 'hidden' === $element.attr( 'type' ) ) {
     8863                       element_id = $element.attr( 'name' );
     8864                    } else {
     8865                       element_id = $element.attr( 'id' );
     8866                    }
     8867                }
     8868                element_id = element_id.trim();
     8869                //lookup condition of fields
     8870                if (!self.has_relations(element_id) && !self.has_siblings(element_id)) return false;
     8871
     8872                if( self.has_siblings(element_id) ) {
     8873                    self.trigger_fake_parent_date_field(element_id);
     8874                }
     8875                if(!self.has_relations(element_id) && self.has_siblings(element_id)){
     8876                    self.trigger_siblings(element_id);
     8877                    return false;
     8878                }
     8879
     8880                self.process_relations( element_id, $element, e );
     8881
     8882                self.paypal_button_condition();
     8883
     8884                self.maybe_clear_upload_container();
     8885            });
     8886
     8887            // Trigger change event to textarea that has tinyMCE editor
     8888            // For non-ajax form load
     8889            $( document ).on( 'tinymce-editor-init', function ( event, editor ) {
     8890                editor.on( 'change', function( e ) {
     8891                    form.find( '#' + $(this).attr( 'id' ) ).change();
     8892                });
     8893            });
     8894            // For ajax form load
     8895            if ( typeof tinyMCE !== 'undefined' && tinyMCE.activeEditor ) {
     8896                tinyMCE.activeEditor.on( 'change', function( e ) {
     8897                    form.find( '#' + $(this).attr( 'id' ) ).change();
     8898                });
     8899            }
     8900
     8901            this.$el.find('.forminator-button.forminator-button-back, .forminator-button.forminator-button-next').on("click", function () {
     8902                form.find('.forminator-field input:not([type="file"]), .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea').trigger( 'forminator.change', 'forminator_emulate_trigger' );
     8903            });
     8904            // Simulate change
     8905            this.$el.find('.forminator-field input, .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea').trigger( 'forminator.change', 'forminator_emulate_trigger' );
     8906            this.init_events();
     8907        },
     8908
     8909        updateConditions: function( data, suffix, form ) {
     8910            // Clone data.
     8911            var newData = JSON.parse(JSON.stringify(data));
     8912
     8913            if ( ! newData.conditions || ! Array.isArray( newData.conditions ) ) {
     8914                return newData;
     8915            }
     8916
     8917            const currentGroup = form.closest('.forminator-col').prop( 'id' );
     8918            newData.conditions.forEach( function ( condition ) {
     8919                if ( ! condition.field || ! condition.group ) {
     8920                    return;
     8921                }
     8922
     8923                // Update dependency field from if it's in the same group.
     8924                if ( condition.group === currentGroup ) {
     8925                    condition.field = condition.field + '-' + suffix;
     8926                }
     8927            } );
     8928
     8929            return newData;
     8930        },
     8931
     8932        process_relations: function( element_id, $element, e ) {
     8933            var self = this;
     8934            // Check if the field has any relations
     8935            var relations = self.get_relations( element_id );
     8936            // Loop all relations the field have
     8937            relations.forEach(function (relation) {
     8938                var logic = self.get_field_logic(relation),
     8939                    action = logic.action,
     8940                    rule = logic.rule,
     8941                    conditions = logic.conditions, // Conditions rules
     8942                    matches = 0 // Number of matches
     8943                ;
     8944
     8945                // If paypal has logic, add form id to paypalHasCondition.
     8946                if ( 0 === relation.indexOf( 'paypal' ) ) {
     8947                    if (
     8948                        0 !== logic.length &&
     8949                        ! window.paypalHasCondition.includes( self.$el.data( 'form-id' ) )
     8950                    ) {
     8951                        window.paypalHasCondition.push( self.$el.data( 'form-id' ) );
     8952                    }
     8953                }
     8954
     8955                conditions.forEach(function (condition) {
     8956                    // If rule is applicable save in matches
     8957                    if (self.is_applicable_rule(condition, action)) {
     8958                        matches++;
     8959                    }
     8960                });
     8961
     8962                if ((rule === "all" && matches === conditions.length) || (rule === "any" && matches > 0)) {
     8963                    //check if the given $element is an jQuery object
     8964                    if( $element instanceof jQuery ) {
     8965                        var pagination = $element.closest('.forminator-pagination');
     8966                    }
     8967                    if (relation === 'submit' && typeof pagination !== 'undefined') {
     8968                        self.toggle_field(relation, 'show', "valid");
     8969                    }
     8970                    self.toggle_field(relation, action, "valid");
     8971                    if (self.has_relations(relation)){
     8972                        if(action === 'hide'){
     8973                            self.hide_element(relation, e);
     8974                        }else{
     8975                            self.show_element(relation, e);
     8976                        }
     8977                    }
     8978                } else {
     8979                    self.toggle_field(relation, action, "invalid");
     8980                    if (self.has_relations(relation)){
     8981                        if(action === 'show'){
     8982                            self.hide_element(relation, e);
     8983                        }else{
     8984                            self.show_element(relation, e);
     8985                        }
     8986                    }
     8987                }
     8988            });
     8989        },
     8990
     8991        /**
     8992         * Register related events
     8993         *
     8994         * @since 1.0.3
     8995         */
     8996        init_events: function () {
     8997            var self = this;
     8998            this.$el.on('forminator.front.condition.restart', function (e) {
     8999                self.on_restart(e);
     9000            });
     9001        },
     9002
     9003        /**
     9004         * Restart conditions
     9005         *
     9006         * @since 1.0.3
     9007         *
     9008         * @param e
     9009         */
     9010        on_restart: function (e) {
     9011            // restart condition
     9012            this.$el.find('.forminator-field input:not([type="file"]), .forminator-row input[type=hidden], .forminator-field select, .forminator-field textarea').trigger( 'change', 'forminator_emulate_trigger' );
     9013        },
     9014
     9015        /**
     9016         * Add missing relations based on fields.conditions
     9017         */
     9018        add_missing_relations: function () {
     9019            var self = this;
     9020            var missedRelations = {};
     9021            if (typeof this.settings.fields !== "undefined") {
     9022                var conditionsFields = this.settings.fields;
     9023                Object.keys(conditionsFields).forEach(function (key) {
     9024                    var conditions = conditionsFields[key]['conditions'];
     9025                    conditions.forEach(function (condition) {
     9026                        var relatedField = condition.field;
     9027                        if (!self.has_relations(relatedField)) {
     9028                            if (typeof missedRelations[relatedField] === 'undefined') {
     9029                                missedRelations[relatedField] = [];
     9030                            }
     9031                            missedRelations[relatedField].push(key);
     9032
     9033                        } else {
     9034                            let relations = self.get_relations(relatedField);
     9035                            if ( -1 !== $.inArray( key, relations ) ) {
     9036                                return;
     9037                            }
     9038                            self.settings.relations[relatedField].push( key );
     9039                        }
     9040                    });
     9041                });
     9042            }
     9043            Object.keys(missedRelations).forEach(function (relatedField) {
     9044                self.settings.relations[relatedField] = missedRelations[relatedField];
     9045            });
     9046        },
     9047
     9048        get_field_logic: function (element_id) {
     9049            if (typeof this.settings.fields[element_id] === "undefined") return [];
     9050            return this.settings.fields[element_id];
     9051        },
     9052
     9053        has_relations: function (element_id) {
     9054            return typeof this.settings.relations[element_id] !== "undefined";
     9055        },
     9056
     9057        get_relations: function (element_id) {
     9058            if (!this.has_relations(element_id)) return [];
     9059
     9060            return $.unique( this.settings.relations[element_id] );
     9061        },
     9062
     9063        get_field_value: function (element_id) {
     9064            if ( '' === element_id ) {
     9065                return '';
     9066            }
     9067
     9068            var $element = this.get_form_field(element_id),
     9069                value = $element.val();
     9070
     9071            //check the type of input
     9072            if (this.field_is_radio($element)) {
     9073                value = $element.filter(":checked").val();
     9074            } else if (this.field_is_signature($element)) {
     9075                value = $element.find( "input[id$='_data']" ).val();
     9076            } else if (this.field_is_checkbox($element)) {
     9077                value = [];
     9078                $element.each(function () {
     9079                    if ($(this).is(':checked')) {
     9080                        value.push($(this).val().toLowerCase());
     9081                    }
     9082                });
     9083
     9084                // if value is empty, return it as null
     9085                if ( 0 === value.length ) {
     9086                    value = null;
     9087                }
     9088            } else if ( this.field_is_textarea_wpeditor( $element ) ) {
     9089                if ( typeof tinyMCE !== 'undefined' && tinyMCE.activeEditor ) {
     9090                    value = tinyMCE.activeEditor.getContent();
     9091                }
     9092            } else if ( this.field_has_inputMask( $element ) ) {
     9093                value = parseFloat( $element.inputmask('unmaskedvalue').replace(',','.') );
     9094            }
     9095            if (!value) return "";
     9096
     9097            return value;
     9098        },
     9099
     9100        get_date_field_value: function(element_id){
     9101            if ( '' === element_id ) {
     9102                return '';
     9103            }
     9104
     9105            var $element = this.get_form_field(element_id);
     9106            //element may not be a real jQuery element for fake virtual parent date field
     9107            var fake_field = true;
     9108            if( $element instanceof jQuery ) {
     9109                fake_field = false;
     9110                //element may just be the wrapper div of child fields
     9111                if( $element.hasClass('forminator-col') ) {
     9112                    fake_field = true;
     9113                }
     9114            }
     9115
     9116            var value = "";
     9117
     9118            if ( !fake_field && this.field_is_datepicker($element) ){
     9119                value = $element.val();
     9120                //check if formats are accepted
     9121                switch ( $element.data('format') ) {
     9122                    case 'dd/mm/yy':
     9123                        value = $element.val().split("/").reverse().join("-");
     9124                        break;
     9125                    case 'dd.mm.yy':
     9126                        value = $element.val().split(".").reverse().join("-");
     9127                        break;
     9128                    case 'dd-mm-yy':
     9129                        value = $element.val().split("-").reverse().join("-");
     9130                        break;
     9131                }
     9132
     9133                var formattedDate = new Date();
     9134
     9135                if ( '' !== value ) {
     9136                    formattedDate = new Date(value);
     9137                }
     9138
     9139                value = {'year':formattedDate.getFullYear(), 'month':formattedDate.getMonth(), 'date':formattedDate.getDate(), 'day':formattedDate.getDay() };
     9140
     9141            } else {
     9142
     9143                var parent   = ( fake_field === true )? element_id : $element.data('parent');
     9144                var year     = this.get_form_field_value(parent+'-year'),
     9145                    mnth     = this.get_form_field_value(parent+'-month'),
     9146                    day      = this.get_form_field_value(parent+'-day');
     9147
     9148                if( year !== "" && mnth !== "" && day !== "" ){
     9149                    var formattedDate = new Date( year + '-' + mnth + '-' + day );
     9150                    value = {'year':formattedDate.getFullYear(), 'month':formattedDate.getMonth(), 'date':formattedDate.getDate(), 'day':formattedDate.getDay() };
     9151                }
     9152
     9153            }
     9154
     9155            if (!value) return "";
     9156
     9157            return value;
     9158
     9159        },
     9160
     9161        field_has_inputMask: function ( $element ) {
     9162            var hasMask = false;
     9163
     9164            $element.each(function () {
     9165                if ( undefined !== $( this ).attr( 'data-inputmask' ) ) {
     9166                    hasMask = true;
     9167                    //break
     9168                    return false;
     9169                }
     9170            });
     9171
     9172            return hasMask;
     9173        },
     9174
     9175        field_is_radio: function ($element) {
     9176            var is_radio = false;
     9177            $element.each(function () {
     9178                if ($(this).attr('type') === 'radio') {
     9179                    is_radio = true;
     9180                    //break
     9181                    return false;
     9182                }
     9183            });
     9184
     9185            return is_radio;
     9186        },
     9187
     9188        field_is_signature: function($element) {
     9189            var is_signature = false;
     9190
     9191            $element.each(function () {
     9192                if ($(this).find('.forminator-field-signature').length > 0) {
     9193                    is_signature = true;
     9194                    //break
     9195                    return false;
     9196                }
     9197            });
     9198
     9199            return is_signature;
     9200        },
     9201
     9202        field_is_datepicker: function ($element) {
     9203            var is_date = false;
     9204            $element.each(function () {
     9205                if ($(this).hasClass('forminator-datepicker')) {
     9206                    is_date = true;
     9207                    //break
     9208                    return false;
     9209                }
     9210            });
     9211
     9212            return is_date;
     9213        },
     9214
     9215        field_is_checkbox: function ($element) {
     9216            var is_checkbox = false;
     9217            $element.each(function () {
     9218                if ($(this).attr('type') === 'checkbox') {
     9219                    is_checkbox = true;
     9220                    //break
     9221                    return false;
     9222                }
     9223            });
     9224
     9225            return is_checkbox;
     9226        },
     9227
     9228        /* field_is_consent: function ( $element ) {
     9229            var is_consent = false;
     9230
     9231            $( 'input[name="' + $element + '"]' ).each(function () {
     9232                if ( $element.indexOf( 'consent' ) >= 0 ) {
     9233                    is_consent = true;
     9234                    //break
     9235                    return false;
     9236                }
     9237            });
     9238
     9239            return is_consent;
     9240        }, */
     9241
     9242        field_is_select: function ($element) {
     9243            return $element.is('select');
     9244        },
     9245
     9246        field_is_textarea_wpeditor: function ($element) {
     9247            var is_textarea_wpeditor = false;
     9248            $element.each(function () {
     9249                if ( $(this).parent( '.wp-editor-container' ).parent( 'div' ).hasClass( 'tmce-active' ) ) {
     9250                    is_textarea_wpeditor = true;
     9251                    //break
     9252                    return false;
     9253                }
     9254            });
     9255
     9256            return is_textarea_wpeditor;
     9257        },
     9258
     9259        field_is_upload: function ($element) {
     9260            var is_upload = false;
     9261
     9262            if ( -1 !== $element.indexOf( 'upload' ) ) {
     9263                is_upload = true;
     9264            }
     9265
     9266            return is_upload;
     9267        },
     9268
     9269        // used in forminatorFrontCalculate
     9270        get_form_field: function (element_id) {
     9271            let $form = this.$el;
     9272            if ( $form.hasClass( 'forminator-grouped-fields' ) ) {
     9273                $form = $form.closest( 'form.forminator-ui' );
     9274            }
     9275
     9276            //find element by suffix -field on id input (default behavior)
     9277            var $element = $form.find('#' + element_id + '-field');
     9278            if ($element.length === 0) {
     9279                $element = $form.find('.' + element_id + '-payment');
     9280                if ($element.length === 0) {
     9281                    //find element by its on name (for radio on singlevalue)
     9282                    $element = $form.find('input[name="' + element_id + '"]');
     9283                    if ($element.length === 0) {
     9284                        // for text area that have uniqid, so we check its name instead
     9285                        $element = $form.find('textarea[name="' + element_id + '"]');
     9286                        if ($element.length === 0) {
     9287                            //find element by its on name[] (for checkbox on multivalue)
     9288                            $element = $form.find('input[name="' + element_id + '[]"]');
     9289                            if ($element.length === 0) {
     9290                                //find element by select name
     9291                                $element = $form.find('select[name="' + element_id + '"]');
     9292                                if ($element.length === 0) {
     9293                                    //find element by direct id (for name field mostly)
     9294                                    //will work for all field with element_id-[somestring]
     9295                                    $element = $form.find('#' + element_id);
     9296                                }
     9297                            }
     9298                        }
     9299                    }
     9300                }
     9301            }
     9302
     9303            return $element;
     9304        },
     9305
     9306        // Extension of get_form_field to get value
     9307        get_form_field_value: function (element_id) {
     9308            //find element by suffix -field on id input (default behavior)
     9309            var $form_id = this.$el.data( 'form-id' ),
     9310                $uid     = this.$el.data( 'uid' ),
     9311                $element = this.$el.find('#forminator-form-' + $form_id + '__field--' + element_id + '_' + $uid );
     9312            if ($element.length === 0) {
     9313                var $element = this.$el.find('#' + element_id + '-field' );
     9314                if ($element.length === 0) {
     9315                    //find element by its on name (for radio on singlevalue)
     9316                    $element = this.$el.find('input[name="' + element_id + '"]');
     9317                    if ($element.length === 0) {
     9318                        // for text area that have uniqid, so we check its name instead
     9319                        $element = this.$el.find('textarea[name="' + element_id + '"]');
     9320                        if ($element.length === 0) {
     9321                            //find element by its on name[] (for checkbox on multivalue)
     9322                            $element = this.$el.find('input[name="' + element_id + '[]"]');
     9323                            if ($element.length === 0) {
     9324                                //find element by select name
     9325                                $element = this.$el.find('select[name="' + element_id + '"]');
     9326                                if ($element.length === 0) {
     9327                                    //find element by direct id (for name field mostly)
     9328                                    //will work for all field with element_id-[somestring]
     9329                                    $element = this.$el.find('#' + element_id);
     9330                                }
     9331                            }
     9332                        }
     9333                    }
     9334                }
     9335            }
     9336
     9337            return $element.val();
     9338        },
     9339
     9340        is_numeric: function (number) {
     9341            return !isNaN(parseFloat(number)) && isFinite(number);
     9342        },
     9343
     9344        is_date_rule: function(operator){
     9345
     9346            var dateRules  = ['day_is', 'day_is_not', 'month_is', 'month_is_not', 'is_before', 'is_after', 'is_before_n_or_more_days', 'is_before_less_than_n_days', 'is_after_n_or_more_days', 'is_after_less_than_n_days'];
     9347
     9348            return dateRules.includes( operator );
     9349
     9350        },
     9351
     9352        has_siblings: function(element){
     9353            if ( '' === element ) {
     9354                return false;
     9355            }
     9356
     9357            element = this.get_form_field(element);
     9358            if( element.data('parent') ) return true;
     9359            return false;
     9360
     9361        },
     9362
     9363        trigger_fake_parent_date_field: function(element_id){
     9364            var element = this.get_form_field(element_id),
     9365                parent  = element.data('parent');
     9366                this.process_relations( parent, {}, {});
     9367        },
     9368
     9369        trigger_siblings: function(element_id){
     9370            var self = this,
     9371                element = self.get_form_field(element_id),
     9372                parent = element.data('parent'),
     9373                siblings = [];
     9374
     9375            siblings    = [parent+'-year', parent+'-month', parent+'-day'];
     9376
     9377            $.each(siblings, function( index, sibling ) {
     9378                if( element_id !== sibling && self.has_relations(sibling) ){
     9379                    self.get_form_field(sibling).trigger('change');
     9380                }
     9381            });
     9382
     9383        },
     9384
     9385        is_applicable_rule: function (condition, action) {
     9386            if (typeof condition === "undefined") return false;
     9387
     9388            if( this.is_date_rule( condition.operator ) ){
     9389                var value1 = this.get_date_field_value(condition.field);
     9390            }else{
     9391                var value1 = this.get_field_value(condition.field);
     9392            }
     9393
     9394            var value2 = condition.value,
     9395                operator = condition.operator
     9396            ;
     9397
     9398            if (action === "show") {
     9399                return this.is_matching(value1, value2, operator) && this.is_hidden(condition.field);
     9400            } else {
     9401                return this.is_matching(value1, value2, operator);
     9402            }
     9403        },
     9404
     9405        is_hidden: function (element_id) {
     9406            var $element_id = this.get_form_field(element_id),
     9407                $column_field = $element_id.closest('.forminator-col'),
     9408                $row_field = $column_field.closest('.forminator-row')
     9409            ;
     9410
     9411            if ( $row_field.hasClass("forminator-hidden-option") ) {
     9412                return true;
     9413            }
     9414
     9415            if( $row_field.hasClass("forminator-hidden") ) {
     9416                return false;
     9417            }
     9418
     9419            return true;
     9420        },
     9421
     9422        is_matching: function (value1, value2, operator) {
     9423            // Match values case
     9424            var isArrayValue = Array.isArray(value1);
     9425
     9426            // Match values case
     9427            if (typeof value1 === 'string') {
     9428                value1 = value1.toLowerCase();
     9429            }
     9430
     9431            if(typeof value2 === 'string'){
     9432                value2 = value2.toLowerCase();
     9433
     9434                if(operator === 'month_is' || operator === 'month_is_not'){
     9435                    var months = {
     9436                        'jan':0,
     9437                        'feb':1,
     9438                        'mar':2,
     9439                        'apr':3,
     9440                        'may':4,
     9441                        'jun':5,
     9442                        'jul':6,
     9443                        'aug':7,
     9444                        'sep':8,
     9445                        'oct':9,
     9446                        'nov':10,
     9447                        'dec':11
     9448                    };
     9449                    if($.inArray(value2, months)){
     9450                        value2 = months[ value2 ];
     9451                    }
     9452                }
     9453                if(operator === 'day_is' || operator === 'day_is_not'){
     9454                    var days = {
     9455                        'su':0,
     9456                        'mo':1,
     9457                        'tu':2,
     9458                        'we':3,
     9459                        'th':4,
     9460                        'fr':5,
     9461                        'sa':6
     9462                    };
     9463                    if($.inArray(value2, days)){
     9464                        value2 = days[ value2 ];
     9465                    }
     9466                }
     9467            }
     9468
     9469            switch (operator) {
     9470                case "is":
     9471                    if (!isArrayValue) {
     9472                        if ( this.is_numeric( value1 ) && this.is_numeric( value2 ) ) {
     9473                            return Number( value1 ) === Number( value2 );
     9474                        }
     9475
     9476                        return value1 === value2;
     9477                    } else {
     9478                        return $.inArray(value2, value1) > -1;
     9479                    }
     9480                case "is_not":
     9481                    if (!isArrayValue) {
     9482                        return value1 !== value2;
     9483                    } else {
     9484                        return $.inArray(value2, value1) === -1;
     9485                    }
     9486                case "is_great":
     9487                    // typecasting to integer, with return `NaN` when its literal chars, so `is_numeric` will fail
     9488                    value1 = +value1;
     9489                    value2 = +value2;
     9490                    return this.is_numeric(value1) && this.is_numeric(value2) ? value1 > value2 : false;
     9491                case "is_less":
     9492                    value1 = +value1;
     9493                    value2 = +value2;
     9494                    return this.is_numeric(value1) && this.is_numeric(value2) ? value1 < value2 : false;
     9495                case "contains":
     9496                    return this.contains(value1, value2);
     9497                case "starts":
     9498                    return value1.startsWith(value2);
     9499                case "ends":
     9500                    return value1.endsWith(value2);
     9501                case "month_is":
     9502                    return value1.month === value2;
     9503                case "month_is_not":
     9504                    return value1.month !== value2;
     9505                case "day_is":
     9506                    return value1.day === value2;
     9507                case "day_is_not":
     9508                    return value1.day !== value2;
     9509                case "is_before":
     9510                    return this.date_is_smaller( value1, value2 );
     9511                case "is_after":
     9512                    return this.date_is_grater( value1, value2 );
     9513                case "is_before_n_or_more_days":
     9514                    return this.date_is_n_days_before_current_date( value1, value2 );
     9515                case "is_before_less_than_n_days":
     9516                    return this.date_is_less_than_n_days_before_current_date( value1, value2 );
     9517                case "is_after_n_or_more_days":
     9518                    return this.date_is_n_days_after_current_date( value1, value2 );
     9519                case "is_after_less_than_n_days":
     9520                    return this.date_is_less_than_n_days_after_current_date( value1, value2 );
     9521            }
     9522
     9523            // Return false if above are not valid
     9524            return false;
     9525        },
     9526
     9527        contains: function (field_value, value) {
     9528            return field_value.toLowerCase().indexOf(value) >= 0;
     9529        },
     9530
     9531        date_is_grater: function( date1, date2 ) {
     9532            return forminatorDateUtil.compare( date1, date2 ) === 1;
     9533        },
     9534
     9535        date_is_smaller: function( date1, date2 ) {
     9536            return forminatorDateUtil.compare( date1, date2 ) === -1;
     9537        },
     9538
     9539        date_is_equal: function( date1, date2 ) {
     9540            return forminatorDateUtil.compare( date1, date2 ) === 0;
     9541        },
     9542
     9543        date_is_n_days_before_current_date: function( date1, n ) {
     9544            n = parseInt( n );
     9545            var current_date = this.get_current_date();
     9546            var diff = forminatorDateUtil.diffInDays( date1, current_date );
     9547            if( isNaN( diff ) ) {
     9548                return false;
     9549            }
     9550            if( n === 0 ) {
     9551                return ( diff === n );
     9552            } else {
     9553                return ( diff >= n );
     9554            }
     9555        },
     9556
     9557        date_is_less_than_n_days_before_current_date: function( date1, n ) {
     9558            n = parseInt( n );
     9559            var current_date = this.get_current_date();
     9560            var diff = forminatorDateUtil.diffInDays( date1, current_date );
     9561            if( isNaN( diff ) ) {
     9562                return false;
     9563            }
     9564
     9565            return ( diff < n && diff > 0 );
     9566        },
     9567
     9568        date_is_n_days_after_current_date: function( date1, n ) {
     9569            n = parseInt( n );
     9570            var current_date = this.get_current_date();
     9571            var diff = forminatorDateUtil.diffInDays( current_date, date1 );
     9572            if( isNaN( diff ) ) {
     9573                return false;
     9574            }
     9575            if( n === 0 ) {
     9576                return ( diff === n );
     9577            } else {
     9578                return ( diff >= n );
     9579            }
     9580        },
     9581
     9582        date_is_less_than_n_days_after_current_date: function( date1, n ) {
     9583            n = parseInt( n );
     9584            var current_date = this.get_current_date();
     9585            var diff = forminatorDateUtil.diffInDays( current_date, date1 );
     9586            if( isNaN( diff ) ) {
     9587                return false;
     9588            }
     9589
     9590            return ( diff < n && diff > 0 );
     9591        },
     9592
     9593        get_current_date: function() {
     9594            return new Date();
     9595        },
     9596
     9597        toggle_field: function (element_id, action, type) {
     9598            var self = this,
     9599                $element_id = this.get_form_field(element_id),
     9600                $column_field = $element_id.closest('.forminator-col'),
     9601                $hidden_upload = $column_field.find('.forminator-input-file-required'),
     9602                $hidden_signature = $column_field.find('[id ^=ctlSignature][id $=_data]'),
     9603                $hidden_wp_editor = $column_field.find('.forminator-wp-editor-required'),
     9604                $row_field = $column_field.closest('.forminator-row'),
     9605                $pagination_next_field = this.$el.find('.forminator-pagination-footer').find('.forminator-button-next'),
     9606                submit_selector = 'submit' === element_id ? '.forminator-button-submit' : '#forminator-paypal-submit',
     9607                $pagination_field = this.$el.find( submit_selector )
     9608                ;
     9609
     9610            // Handle show action
     9611            if (action === "show") {
     9612                if (type === "valid") {
     9613                    $row_field.removeClass('forminator-hidden');
     9614                    $column_field.removeClass('forminator-hidden');
     9615                    $pagination_next_field.removeClass('forminator-hidden');
     9616                    if ($hidden_upload.length > 0) {
     9617                        $hidden_upload.addClass('do-validate');
     9618                    }
     9619                    if ($hidden_wp_editor.length > 0) {
     9620                        $hidden_wp_editor.addClass('do-validate');
     9621                    }
     9622                    if ($hidden_signature.length > 0) {
     9623                        $hidden_signature.addClass('do-validate');
     9624                    }
     9625                    setTimeout(
     9626                        function() {
     9627                            if ( 'submit' === element_id ) {
     9628                                $pagination_field.removeClass('forminator-hidden');
     9629                            }
     9630                            if ( 0 === element_id.indexOf( 'paypal' ) ) {
     9631                                self.$el.find( '.forminator-button-submit' ).addClass( 'forminator-hidden' );
     9632                                $pagination_field.removeClass( 'forminator-hidden' );
     9633                            }
     9634                        },
     9635                        100
     9636                    );
     9637                } else {
     9638                    $column_field.addClass('forminator-hidden');
     9639                    setTimeout(
     9640                        function() {
     9641                            if ( 'submit' === element_id ) {
     9642                                $pagination_field.addClass('forminator-hidden');
     9643                            }
     9644                            if ( 0 === element_id.indexOf( 'paypal' ) ) {
     9645                                self.$el.find( '.forminator-button-submit' ).removeClass( 'forminator-hidden' );
     9646                                $pagination_field.addClass('forminator-hidden');
     9647                            }
     9648                        },
     9649                        100
     9650                    );
     9651                    if ($hidden_upload.length > 0) {
     9652                        $hidden_upload.removeClass('do-validate');
     9653                    }
     9654                    if ($hidden_wp_editor.length > 0) {
     9655                        $hidden_wp_editor.removeClass('do-validate');
     9656                    }
     9657                    if ($hidden_signature.length > 0) {
     9658                        $hidden_signature.removeClass('do-validate');
     9659                    }
     9660                    if ($row_field.find('> .forminator-col:not(.forminator-hidden)').length === 0) {
     9661                        $row_field.addClass('forminator-hidden');
     9662                    }
     9663                }
     9664            }
     9665
     9666            // Handle hide action
     9667            if (action === "hide") {
     9668                if (type === "valid") {
     9669                    $column_field.addClass('forminator-hidden');
     9670                    $pagination_field.addClass('forminator-hidden');
     9671                    if ($hidden_upload.length > 0) {
     9672                        $hidden_upload.removeClass('do-validate');
     9673                    }
     9674                    if ($hidden_wp_editor.length > 0) {
     9675                        $hidden_wp_editor.removeClass('do-validate');
     9676                    }
     9677                    if ($hidden_signature.length > 0) {
     9678                        $hidden_signature.removeClass('do-validate');
     9679                    }
     9680                    if ($row_field.find('> .forminator-col:not(.forminator-hidden)').length === 0) {
     9681                        $row_field.addClass('forminator-hidden');
     9682                    }
     9683                    setTimeout(
     9684                        function() {
     9685                            if ( 'submit' === element_id ) {
     9686                                $pagination_field.addClass('forminator-hidden');
     9687                            }
     9688                            if ( 0 === element_id.indexOf( 'paypal' ) ) {
     9689                                self.$el.find( '.forminator-button-submit' ).removeClass( 'forminator-hidden' );
     9690                                $pagination_field.addClass( 'forminator-hidden' );
     9691                            }
     9692                        },
     9693                        100
     9694                    );
     9695                } else {
     9696                    $row_field.removeClass('forminator-hidden');
     9697                    $column_field.removeClass('forminator-hidden');
     9698                    $pagination_field.removeClass('forminator-hidden');
     9699                    if ($hidden_upload.length > 0) {
     9700                        $hidden_upload.addClass('do-validate');
     9701                    }
     9702                    if ($hidden_wp_editor.length > 0) {
     9703                        $hidden_wp_editor.addClass('do-validate');
     9704                    }
     9705                    if ($hidden_signature.length > 0) {
     9706                        $hidden_signature.addClass('do-validate');
     9707                    }
     9708                    setTimeout(
     9709                        function() {
     9710                            if ( 'submit' === element_id ) {
     9711                                $pagination_field.removeClass('forminator-hidden');
     9712                            }
     9713                            if ( 0 === element_id.indexOf( 'paypal' ) ) {
     9714                                self.$el.find( '.forminator-button-submit' ).addClass( 'forminator-hidden' );
     9715                                $pagination_field.removeClass( 'forminator-hidden' );
     9716                            }
     9717                        },
     9718                        100
     9719                    );
     9720                }
     9721            }
     9722
     9723            this.$el.trigger('forminator:field:condition:toggled');
     9724
     9725            this.toggle_confirm_password( $element_id );
     9726        },
     9727
     9728        clear_value: function(element_id, e) {
     9729            var $element = this.get_form_field(element_id),
     9730                value = this.get_field_value(element_id)
     9731            ;
     9732            if ( $element.hasClass('forminator-cleared-value') ) {
     9733                return;
     9734            }
     9735            $element.addClass('forminator-cleared-value');
     9736
     9737            // Execute only on human action
     9738            if (e.originalEvent !== undefined) {
     9739                if (this.field_is_radio($element)) {
     9740                    $element.attr('data-previous-value', value);
     9741                    $element.removeAttr('checked');
     9742                } else if (this.field_is_checkbox($element)) {
     9743                    $element.each(function () {
     9744                        $(this).attr('data-previous-value', value);
     9745                        $(this).prop('checked', false);
     9746                    });
     9747                } else {
     9748                    $element.attr('data-previous-value', value);
     9749                    $element.val('');
     9750                }
     9751            }
     9752        },
     9753
     9754        restore_value: function(element_id, e) {
     9755            var $element = this.get_form_field(element_id),
     9756                value = $element.attr('data-previous-value')
     9757            ;
     9758            if ( ! $element.hasClass('forminator-cleared-value') ) {
     9759                return;
     9760            }
     9761
     9762            // Execute only on human action
     9763            if (e.originalEvent === undefined) {
     9764                return;
     9765            }
     9766
     9767            $element.removeClass('forminator-cleared-value');
     9768
     9769            // Return after class is removed if field is upload
     9770            if ( this.field_is_upload( element_id ) ) {
     9771                return;
     9772            }
     9773
     9774            if(!value) return;
     9775
     9776            if (this.field_is_radio($element)) {
     9777                $element.val([value]);
     9778            } else if (this.field_is_checkbox($element)) {
     9779                $element.each(function () {
     9780                    var value = $(this).attr('data-previous-value');
     9781
     9782                    if (!value) return;
     9783
     9784                    if (value.indexOf($(this).val().toLowerCase()) >= 0) {
     9785                        $(this).prop( "checked", true );
     9786                    }
     9787                });
     9788            } else {
     9789                $element.val(value);
     9790            }
     9791        },
     9792
     9793        hide_element: function (relation, e){
     9794            var self = this,
     9795                sub_relations = self.get_relations(relation);
     9796
     9797            self.clear_value(relation, e);
     9798
     9799            sub_relations.forEach(function (sub_relation) {
     9800                // Do opposite action because condition is definitely not met because dependent field is hidden.
     9801                let logic = self.get_field_logic(sub_relation),
     9802                    action = 'hide' === logic.action ? 'show' : 'hide';
     9803                self.toggle_field(sub_relation, action, "valid");
     9804
     9805                if (self.has_relations(sub_relation)) {
     9806                    if ( 'hide' === action ) {
     9807                        self.hide_element(sub_relation, e);
     9808                    } else {
     9809                        self.show_element(sub_relation, e);
     9810                    }
     9811                }
     9812            });
     9813        },
     9814
     9815        show_element: function (relation, e){
     9816            var self          = this,
     9817                sub_relations = self.get_relations(relation)
     9818            ;
     9819
     9820            this.restore_value(relation, e);
     9821            this.textareaFix(this.$el, relation, e);
     9822
     9823            sub_relations.forEach(function (sub_relation) {
     9824                var logic = self.get_field_logic(sub_relation),
     9825                    action = logic.action,
     9826                    rule = logic.rule,
     9827                    conditions = logic.conditions, // Conditions rules
     9828                    matches = 0 // Number of matches
     9829                ;
     9830
     9831                conditions.forEach(function (condition) {
     9832                    // If rule is applicable save in matches
     9833                    if (self.is_applicable_rule(condition, action)) {
     9834                        matches++;
     9835                    }
     9836                });
     9837
     9838                if ((rule === "all" && matches === conditions.length) || (rule === "any" && matches > 0)) {
     9839                    self.toggle_field(sub_relation, action, "valid");
     9840                }else{
     9841                    self.toggle_field(sub_relation, action, "invalid");
     9842                }
     9843                if (self.has_relations(sub_relation)) {
     9844                    sub_relations = self.show_element(sub_relation, e);
     9845                }
     9846            });
     9847        },
     9848
     9849        paypal_button_condition: function() {
     9850            var paymentElement = this.$el.find('.forminator-paypal-row'),
     9851                paymentPageElement = this.$el.find('.forminator-pagination-footer').find('.forminator-button-paypal');
     9852            if( paymentElement.length > 0 ) {
     9853                this.$el.find('.forminator-button-submit').closest('.forminator-row').removeClass('forminator-hidden');
     9854                if( ! paymentElement.hasClass('forminator-hidden') ) {
     9855                    this.$el.find('.forminator-button-submit').closest('.forminator-row').addClass('forminator-hidden');
     9856                }
     9857            }
     9858            if ( paymentPageElement.length > 0 ) {
     9859                if( paymentPageElement.hasClass('forminator-hidden') ) {
     9860                    this.$el.find('.forminator-button-submit').removeClass('forminator-hidden');
     9861                } else{
     9862                    this.$el.find('.forminator-button-submit').addClass('forminator-hidden');
     9863                }
     9864            }
     9865        },
     9866
     9867        maybe_clear_upload_container: function() {
     9868            this.$el.find( '.forminator-row.forminator-hidden input[type="file"]' ).each( function () {
     9869                if ( '' === $(this).val() ) {
     9870                    if ( $(this).parent().hasClass( 'forminator-multi-upload' ) ) {
     9871                        $(this).parent().siblings( '.forminator-uploaded-files' ).empty();
     9872                    } else {
     9873                        $(this).siblings( 'span' ).text( $(this).siblings( 'span' ).data( 'empty-text' ) );
     9874                        $(this).siblings( '.forminator-button-delete' ).hide();
     9875                    }
     9876                }
     9877            });
     9878        },
     9879
     9880        // Fixes textarea bug with labels when using Material design style
     9881        textareaFix: function (form ,relation, e){
     9882            var label = $( '#' + relation + ' .forminator-label' )
     9883            ;
     9884
     9885            if ( relation.includes( 'textarea' ) && form.hasClass( 'forminator-design--material' ) && 0 < label.length ) {
     9886                var materialTextarea = $( '#' + relation + ' .forminator-textarea'),
     9887                    labelPaddingTop  = label.height() + 9 // Based on forminator-form.js
     9888                ;
     9889
     9890                label.css({
     9891                  'padding-top': labelPaddingTop + 'px'
     9892                });
     9893
     9894                materialTextarea.css({
     9895                  'padding-top': labelPaddingTop + 'px'
     9896                });
     9897            }
     9898        },
     9899
     9900        // Maybe toggle confirm password field if necessary
     9901        toggle_confirm_password: function ( $element ) {
     9902            if ( 0 !== $element.length && $element.attr( 'id' ) && -1 !== $element.attr( 'id' ).indexOf( 'password' ) ) {
     9903                var column = $element.closest( '.forminator-col' );
     9904                if ( column.hasClass( 'forminator-hidden' ) ) {
     9905                    column.parent( '.forminator-row' ).next( '.forminator-row' ).addClass( 'forminator-hidden' );
     9906                } else {
     9907                    column.parent( '.forminator-row' ).next( '.forminator-row' ).removeClass( 'forminator-hidden' );
     9908                }
     9909            }
     9910        },
     9911    });
     9912
     9913    // A really lightweight plugin wrapper around the constructor,
     9914    // preventing against multiple instantiations
     9915    $.fn[pluginName] = function (options, calendar) {
     9916        return this.each(function () {
     9917            if (!$.data(this, pluginName)) {
     9918                $.data(this, pluginName, new ForminatorFrontCondition(this, options, calendar));
     9919            }
     9920        });
     9921    };
     9922
     9923})(jQuery, window, document);
     9924
     9925// the semi-colon before function invocation is a safety net against concatenated
     9926// scripts and/or other plugins which may not be closed properly.
     9927;// noinspection JSUnusedLocalSymbols
     9928(function ($, window, document, undefined) {
     9929
     9930    "use strict";
     9931
     9932    // undefined is used here as the undefined global variable in ECMAScript 3 is
     9933    // mutable (ie. it can be changed by someone else). undefined isn't really being
     9934    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     9935    // can no longer be modified.
     9936
     9937    // window and document are passed through as local variables rather than global
     9938    // as this (slightly) quickens the resolution process and can be more efficiently
     9939    // minified (especially when both are regularly referenced in your plugin).
     9940
     9941    // Create the defaults once
     9942    var pluginName = "forminatorFrontSubmit",
     9943        defaults = {
     9944            form_type: 'custom-form',
     9945            forminatorFront: false,
     9946            forminator_selector: '',
     9947            chart_design: 'bar',
     9948            chart_options: {}
     9949        };
     9950
     9951    // The actual plugin constructor
     9952    function ForminatorFrontSubmit(element, options) {
     9953        this.element = element;
     9954        this.$el = $(this.element);
     9955        this.forminatorFront = null;
     9956
     9957
     9958        // jQuery has an extend method which merges the contents of two or
     9959        // more objects, storing the result in the first object. The first object
     9960        // is generally empty as we don't want to alter the default options for
     9961        // future instances of the plugin
     9962        this.settings = $.extend({}, defaults, options);
     9963        this._defaults = defaults;
     9964        this._name = pluginName;
     9965        this.init();
     9966    }
     9967
     9968    // Avoid Plugin.prototype conflicts
     9969    $.extend(ForminatorFrontSubmit.prototype, {
     9970        init: function () {
     9971            this.forminatorFront = this.$el.data('forminatorFront');
     9972            switch (this.settings.form_type) {
     9973                case 'custom-form':
     9974                    if (!this.settings.forminator_selector || !$(this.settings.forminator_selector).length) {
     9975                        this.settings.forminator_selector = '.forminator-custom-form';
     9976                    }
     9977                    this.handle_submit_custom_form();
     9978                    break;
     9979                case 'quiz':
     9980                    if (!this.settings.forminator_selector || !$(this.settings.forminator_selector).length) {
     9981                        this.settings.forminator_selector = '.forminator-quiz';
     9982                    }
     9983                    this.handle_submit_quiz();
     9984                    break;
     9985                case 'poll':
     9986                    if (!this.settings.forminator_selector || !$(this.settings.forminator_selector).length) {
     9987                        this.settings.forminator_selector = '.forminator-poll';
     9988                    }
     9989                    this.handle_submit_poll();
     9990                    break;
     9991
     9992            }
     9993        },
     9994
     9995        decodeHtmlEntity: function(str) {
     9996            return str.replace(/&#(\d+);/g, function(match, dec) {
     9997                return String.fromCharCode(dec);
     9998            });
     9999        },
     10000
     10001        removeCountryCode: function( form ) {
     10002            form.find('.forminator-field--phone').each(function() {
     10003                var phone_element = $(this);
     10004                if ( !phone_element.data('required') && 'international' === phone_element.data('validation') ) {
     10005                    var dialCode = '+' + phone_element.intlTelInput( 'getSelectedCountryData' ).dialCode + ' ';
     10006                    var currentInput = phone_element.val();
     10007                    if (dialCode === currentInput)
     10008                        phone_element.val('');
     10009                } else if ( !phone_element.data('required') && 'standard' === phone_element.data('validation') ) {
     10010                    var dialCode = '+' + phone_element.intlTelInput( 'getSelectedCountryData' ).dialCode;
     10011                    var currentInput = phone_element.val();
     10012                    if (dialCode === currentInput)
     10013                        phone_element.val('');
     10014                }
     10015            });
     10016        },
     10017
     10018        handle_submit_custom_form: function () {
     10019            var self = this,
     10020                saveDraftBtn = self.$el.find( '.forminator-save-draft-link' );
     10021
     10022            var success_available = self.$el.find('.forminator-response-message').find('.forminator-label--success').not(':hidden');
     10023            if (success_available.length) {
     10024                self.focus_to_element(self.$el.find('.forminator-response-message'));
     10025            }
     10026            $('.def-ajaxloader').hide();
     10027            var isSent = false;
     10028            $('body').on('click', '#lostPhone', function (e) {
     10029                e.preventDefault();
     10030                var that = $(this);
     10031                if (isSent === false) {
     10032                    isSent = true;
     10033                    $.ajax({
     10034                        type: 'GET',
     10035                        url: that.attr('href'),
     10036                        beforeSend: function () {
     10037                            that.attr('disabled', 'disabled');
     10038                            $('.def-ajaxloader').show();
     10039                        },
     10040                        success: function (data) {
     10041                            that.removeAttr('disabled');
     10042                            $('.def-ajaxloader').hide();
     10043                            $('.notification').text(data.data.message);
     10044                            isSent = false;
     10045                        }
     10046                    })
     10047                }
     10048            });
     10049
     10050            $('body').on('click', '.auth-back', function (e) {
     10051                e.preventDefault();
     10052                var moduleId  = self.$el.attr( 'id' ),
     10053                    authId    = moduleId + '-authentication',
     10054                    authInput = $( '#' + authId + '-input' )
     10055                ;
     10056                authInput.attr( 'disabled','disabled' );
     10057                FUI.closeAuthentication();
     10058            });
     10059
     10060            if ( 0 !== saveDraftBtn.length ) {
     10061                this.handle_submit_form_draft();
     10062            }
     10063
     10064            $( 'body' ).off( 'forminator:preSubmit:paypal', this.settings.forminator_selector )
     10065                    .on( 'forminator:preSubmit:paypal', this.settings.forminator_selector, function( e, $target_message ) { return self.processCaptcha( self, e, $target_message ); } );
     10066            $( 'body' ).off( 'submit.frontSubmit', this.settings.forminator_selector );
     10067            $( 'body' ).on( 'submit.frontSubmit', this.settings.forminator_selector, function ( e, submitter ) {
     10068
     10069                if ( self.$el.find( '.forminator-button-submit' ).prop('disabled') ) {
     10070                    return false;
     10071                }
     10072
     10073                // Disable submit button right away.
     10074                self.disable_form_submit( self, true );
     10075
     10076                if ( 0 !== self.$el.find( 'input[type="hidden"][value="forminator_submit_preview_form_custom-forms"]' ).length ) {
     10077                    self.disable_form_submit( self, false );
     10078                    return false;
     10079                }
     10080
     10081                var $this = $(this),
     10082                    thisForm = this,
     10083                    submitEvent = e,
     10084                    formData = new FormData( this ),
     10085                    $target_message = $this.find('.forminator-response-message'),
     10086                    $saveDraft = 'true' === self.$el.find( 'input[name="save_draft"]' ).val() ? true : false,
     10087                    $datepicker = $('body').find( '#ui-datepicker-div.forminator-custom-form-' + self.$el.data( 'form-id' ) )
     10088                    ;
     10089
     10090                // to remove dial code from the phone field which are optional so that validation doesn't throw error.
     10091                self.removeCountryCode( $this );
     10092
     10093                if( self.settings.inline_validation && self.$el.find('.forminator-uploaded-files').length > 0 && ! $saveDraft ) {
     10094                    var file_error = self.$el.find('.forminator-uploaded-files li.forminator-has_error');
     10095                    if( file_error.length > 0 ) {
     10096                        self.disable_form_submit( self, false );
     10097                        return false;
     10098                    }
     10099                }
     10100
     10101                //check originalEvent exists and submit button is not exits or hidden
     10102                if( submitEvent.originalEvent !== undefined ) {
     10103                    var submitBtn = $(this).find('.forminator-button-submit').first();
     10104                    if( submitBtn.length === 0 || $( submitBtn ).closest('.forminator-col').hasClass('forminator-hidden') ) {
     10105                        self.disable_form_submit( self, false );
     10106                        return false;
     10107                    }
     10108                }
     10109                // Check if datepicker is open, prevent submit
     10110                if ( 0 !== $datepicker.length && self.$el.datepicker( "widget" ).is(":visible") ) {
     10111                    self.disable_form_submit( self, false );
     10112                    return false;
     10113                }
     10114
     10115                if ( self.$el.data( 'forminatorFrontPayment' ) && ! $saveDraft ) {
     10116                    // Disable submit button right away to prevent multiple submissions
     10117                    $this.find( '.forminator-button-submit' ).attr( 'disabled', true );
     10118                    if ( false === self.processCaptcha( self, e, $target_message ) ) {
     10119                        $this.find( '.forminator-button-submit' ).attr( 'disabled', false );
     10120                        self.disable_form_submit( self, false );
     10121                        return false;
     10122                    }
     10123                }
     10124
     10125                self.multi_upload_disable( $this, true );
     10126
     10127                var submitCallback = function() {
     10128                    var pagination    = self.$el.find( '.forminator-pagination:visible' ),
     10129                        hasPagination = !! pagination.length,
     10130                        formStep      = pagination.index( '.forminator-pagination' )
     10131                        ;
     10132
     10133                    formData = new FormData(this); // reinit values
     10134
     10135                    if ( $saveDraft && hasPagination ) {
     10136                        formData.append( 'draft_page', formStep );
     10137                    }
     10138
     10139                    if ( ! self.$el.data( 'forminatorFrontPayment' ) && ! $saveDraft ) {
     10140                        if ( false === self.processCaptcha( self, e, $target_message ) ) {
     10141                            self.disable_form_submit( self, false );
     10142                            return false;
     10143                        }
     10144                    }
     10145
     10146                    // Should check if submitted thru save draft button
     10147                    if ( self.$el.hasClass('forminator_ajax') || $saveDraft ) {
     10148                        $target_message.html('');
     10149                        self.$el.find('.forminator-button-submit').addClass('forminator-button-onload');
     10150
     10151                        // Safari FIX, if empty file input, ajax broken
     10152                        // Check if input empty
     10153                        self.$el.find("input[type=file]").each(function () {
     10154                            // IE does not support FormData.delete()
     10155                            if ($(this).val() === "") {
     10156                                if (typeof(window.FormData.prototype.delete) === 'function') {
     10157                                    formData.delete($(this).attr('name'));
     10158                                }
     10159                            }
     10160                        });
     10161
     10162                        var form_type = '';
     10163                        if( typeof self.settings.has_loader !== "undefined" && self.settings.has_loader ) {
     10164                            // Disable form fields
     10165                            form_type = self.$el.find('input[name="form_type"]').val();
     10166                            if( 'login' !== form_type ) {
     10167                                self.$el.addClass('forminator-fields-disabled');
     10168                            }
     10169                            $target_message.html('<p>' + self.settings.loader_label + '</p>');
     10170                            self.focus_to_element( $target_message );
     10171
     10172                            $target_message.removeAttr("aria-hidden")
     10173                                .prop("tabindex", "-1")
     10174                                .removeClass('forminator-success forminator-error forminator-accessible')
     10175                                .addClass('forminator-loading forminator-show');
     10176                        }
     10177
     10178                        e.preventDefault();
     10179                        $.ajax({
     10180                            type: 'POST',
     10181                            url: window.ForminatorFront.ajaxUrl,
     10182                            data: formData,
     10183                            cache: false,
     10184                            contentType: false,
     10185                            processData: false,
     10186                            beforeSend: function () {
     10187                                $this.find('button').attr('disabled', true);
     10188                                $this.trigger('before:forminator:form:submit', formData);
     10189                            },
     10190                            success: function( data ) {
     10191                                if( ( ! data && 'undefined' !== typeof data ) || 'object' !== typeof data.data ) {
     10192                                    $this.find( 'button' ).removeAttr( 'disabled' );
     10193                                    $target_message.addClass('forminator-error')
     10194                                        .html( '<p>' + window.ForminatorFront.cform.error + '<br>(' + data.data + ')</p>');
     10195                                    self.focus_to_element($target_message);
     10196
     10197                                    if ( data.data ) {
     10198                                        $this.trigger('forminator:form:submit:failed', [ formData, data.data ] );
     10199                                    }
     10200
     10201                                    return false;
     10202                                }
     10203
     10204                                // Process Save Draft's response
     10205                                if ( data.success && undefined !== data.data.type && 'save_draft' === data.data.type ) {
     10206                                    self.showDraftLink( data.data );
     10207                                    return false;
     10208                                }
     10209
     10210                                // Hide validation errors
     10211                                $this.find( '.forminator-error-message' ).not('.forminator-uploaded-files .forminator-error-message').remove();
     10212                                $this.find( '.forminator-field' ).removeClass( 'forminator-has_error' );
     10213
     10214                                $this.find( 'button' ).removeAttr( 'disabled' );
     10215                                $target_message.html( '' ).removeClass( 'forminator-accessible forminator-error forminator-success' );
     10216                                if( self.settings.hasLeads && 'undefined' !== typeof data.data.entry_id ) {
     10217                                    self.showQuiz( self.$el );
     10218                                    $('#forminator-module-' + self.settings.quiz_id + ' input[name=entry_id]' ).val( data.data.entry_id );
     10219                                    if( 'end' === self.settings.form_placement ) {
     10220                                        $('#forminator-module-' + self.settings.quiz_id).submit();
     10221                                    }
     10222
     10223                                    return false;
     10224                                }
     10225                                if ( typeof data !== 'undefined' &&
     10226                                     typeof data.data !== 'undefined' &&
     10227                                     typeof data.data.authentication !== 'undefined' &&
     10228                                    ( 'show' === data.data.authentication || 'invalid' === data.data.authentication ) ) {
     10229                                    var moduleId  = self.$el.attr( 'id' ),
     10230                                        authId    = moduleId + '-authentication',
     10231                                        authField = $( '#' + authId ),
     10232                                        authInput = $( '#' + authId + '-input' ),
     10233                                        authToken = $( '#' + authId + '-token' )
     10234                                    ;
     10235                                    authField.find('.forminator-authentication-notice').removeClass('error');
     10236                                    authField.find('.lost-device-url').attr('href', data.data.lost_url);
     10237
     10238                                    if( 'show' === data.data.authentication ) {
     10239                                        self.$el.find('.forminator-authentication-nav').html('').append( data.data.auth_nav );
     10240                                        self.$el.find('.forminator-authentication-box').hide();
     10241                                        if ( 'fallback-email' === data.data.auth_method ) {
     10242                                            self.$el.find('.wpdef-2fa-email-resend input').click();
     10243                                            self.$el.find('.notification').hide();
     10244                                        }
     10245                                        self.$el.find( '#forminator-2fa-' + data.data.auth_method ).show();
     10246                                        self.$el.find('.forminator-authentication-box input').attr( 'disabled', true );
     10247                                        self.$el.find( '#forminator-2fa-' + data.data.auth_method + ' input' ).attr( 'disabled', false );
     10248                                        self.$el.find('.forminator-2fa-link').show();
     10249                                        self.$el.find('#forminator-2fa-link-' + data.data.auth_method).hide();
     10250                                        authInput.removeAttr( 'disabled' ).val(data.data.auth_method);
     10251                                        authToken.val( data.data.auth_token );
     10252                                        FUI.openAuthentication( authId, moduleId, authId + '-input' );
     10253                                    }
     10254                                    if ( 'invalid' === data.data.authentication ) {
     10255                                        authField.find('.forminator-authentication-notice').addClass('error');
     10256                                        authField.find('.forminator-authentication-notice').html('<p>' + data.data.message + '</p>');
     10257                                        $this.trigger('forminator:form:submit:failed', [ formData, data.data.message ] );
     10258                                    }
     10259
     10260                                    return false;
     10261
     10262                                }
     10263                                var $label_class = data.success ? 'forminator-success' : 'forminator-error';
     10264
     10265                                if (typeof data.message !== "undefined") {
     10266                                    $target_message.removeAttr("aria-hidden")
     10267                                        .prop("tabindex", "-1")
     10268                                        .addClass($label_class + ' forminator-show');
     10269                                    self.focus_to_element( $target_message, false, data.fadeout, data.fadeout_time );
     10270                                    $target_message.html( data.message );
     10271
     10272                                    if(!data.data.success && data.data.errors.length) {
     10273                                        var errors_html = '<ul class="forminator-screen-reader-only">';
     10274                                        $.each(data.data.errors, function(index,value) {
     10275                                            for(var propName in value) {
     10276                                                if(value.hasOwnProperty(propName)) {
     10277                                                   errors_html += '<li>' + value[propName] + '</li>';
     10278                                                }
     10279                                            }
     10280                                        });
     10281                                        errors_html += '</ul>';
     10282                                        $target_message.append(errors_html);
     10283                                    }
     10284                                } else {
     10285                                    if (typeof data.data !== "undefined") {
     10286                                        var isShowSuccessMessage = true;
     10287
     10288                                        //Remove background of the success message if form behaviour is redirect and the success message is empty
     10289                                        if (
     10290                                            typeof data.data.url !== 'undefined' &&
     10291                                            typeof data.data.newtab !== 'undefined' &&
     10292                                            'newtab_thankyou' !== data.data.newtab
     10293                                        ) {
     10294                                            isShowSuccessMessage = false;
     10295                                        }
     10296                                        if ( isShowSuccessMessage ) {
     10297                                            $target_message.removeAttr("aria-hidden")
     10298                                                .prop("tabindex", "-1")
     10299                                                .addClass($label_class + ' forminator-show');
     10300                                            self.focus_to_element( $target_message, false, data.data.fadeout, data.data.fadeout_time );
     10301                                            $target_message.html( data.data.message );
     10302                                        }
     10303
     10304                                        if(!data.data.success && typeof data.data.errors !== 'undefined' && data.data.errors.length) {
     10305                                            var errors_html = '<ul class="forminator-screen-reader-only">';
     10306                                            $.each(data.data.errors, function(index,value) {
     10307                                                //errors_html += '<li>' + value
     10308                                                for(var propName in value) {
     10309                                                    if(value.hasOwnProperty(propName)) {
     10310                                                        errors_html += '<li>' + value[propName] + '</li>';
     10311                                                    }
     10312                                                }
     10313                                            });
     10314                                            errors_html += '</ul>';
     10315                                            $target_message.append(errors_html);
     10316                                        }
     10317
     10318                                        if ( typeof data.data.stripe3d !== "undefined" ) {
     10319                                            if ( typeof data.data.subscription !== "undefined" ) {
     10320                                                $this.trigger('forminator:form:submit:stripe:3dsecurity', [ data.data.secret, data.data.subscription ]);
     10321                                            } else {
     10322                                                $this.trigger('forminator:form:submit:stripe:3dsecurity', [ data.data.secret, false ]);
     10323                                            }
     10324                                        }
     10325                                    }
     10326                                }
     10327
     10328                                if ( ! data.data.success ) {
     10329                                    let errors = typeof data.data.errors !== 'undefined' && data.data.errors.length ? data.data.errors : '';
     10330                                    $this.trigger('forminator:form:submit:failed', [ formData, errors ] );
     10331                                    self.multi_upload_disable( $this, false );
     10332
     10333                                    if ( errors ) {
     10334                                        self.show_messages(errors);
     10335                                    }
     10336                                }
     10337
     10338                                if (data.success === true) {
     10339                                    var hideForm = typeof data.data.behav !== "undefined" && data.data.behav === 'behaviour-hide';
     10340                                    // Reset form
     10341                                    if ($this[0]) {
     10342                                        var resetEnabled = self.settings.resetEnabled;
     10343                                        if(resetEnabled && ! hideForm) {
     10344                                            $this[0].reset();
     10345                                        }
     10346
     10347                                        self.$el.trigger('forminator:field:condition:toggled');
     10348
     10349                                        // reset signatures
     10350                                        $this.find('.forminator-field-signature img').trigger('click');
     10351
     10352                                        // Reset Select field submissions
     10353                                        if (typeof data.data.select_field !== "undefined") {
     10354                                            $.each(data.data.select_field, function (index, value) {
     10355                                                if (value.length > 0) {
     10356                                                    $.each(value, function (i, v) {
     10357                                                        if (v['value']) {
     10358                                                            if (v['type'] === 'multiselect') {
     10359                                                                $this.find("#" + index + " input[value=" + v['value'] + "]").closest('.forminator-option').remove().trigger("change");
     10360                                                            } else {
     10361                                                                $this.find("#" + index + " option[value=" + v['value'] + "]").remove().trigger("change");
     10362                                                            }
     10363                                                        }
     10364                                                    });
     10365                                                }
     10366                                            });
     10367                                        }
     10368                                        // Reset upload field
     10369                                        $this.find(".forminator-button-delete").hide();
     10370                                        $this.find('.forminator-file-upload input').val("");
     10371                                        $this.find('.forminator-file-upload > span').html(window.ForminatorFront.cform.no_file_chosen);
     10372                                        $this.find('ul.forminator-uploaded-files').html('');
     10373                                        self.$el.find('ul.forminator-uploaded-files').html('');
     10374                                        self.$el.find( '.forminator-multifile-hidden' ).val('');
     10375                                        //self.$el.find( '.forminator-input-file' ).val('');
     10376
     10377                                        // Reset selects
     10378                                        if ( $this.find('.forminator-select').length > 0 ) {
     10379                                            $this.find('.forminator-select').each(function (index, value) {
     10380                                                var defaultValue = $(value).data('default-value');
     10381                                                if ( '' === defaultValue ) {
     10382                                                    defaultValue = $(value).val();
     10383                                                }
     10384                                                $(value).val(defaultValue).trigger("fui:change");
     10385                                            });
     10386                                        }
     10387                                        // Reset multiselect
     10388                                        $this.find('.multiselect-default-values').each(function () {
     10389                                            var defaultValuesObj = '' !== $(this).val() ?  $.parseJSON( $(this).val() ) : [],
     10390                                                defaultValuesArr = Object.values( defaultValuesObj ),
     10391                                                multiSelect = $(this).closest('.forminator-multiselect');
     10392                                            multiSelect.find('input[type="checkbox"]').each(function (i, val) {
     10393                                                if( -1 !== $.inArray( $(val).val(), defaultValuesArr ) ) {
     10394                                                    $(val).prop('checked', true);
     10395                                                    $(val).closest('label').addClass('forminator-is_checked');
     10396                                                } else {
     10397                                                    $(val).prop('checked', false);
     10398                                                    $(val).closest('label').removeClass('forminator-is_checked');
     10399                                                }
     10400                                            });
     10401                                        });
     10402                                        self.multi_upload_disable( $this, false );
     10403                                        $this.trigger('forminator:form:submit:success', formData);
     10404
     10405                                        // restart condition after form reset to ensure values of input already reset-ed too
     10406                                        $this.trigger('forminator.front.condition.restart');
     10407                                    }
     10408
     10409                                    if (typeof data.data.url !== "undefined") {
     10410
     10411                                        //check if newtab option is selected
     10412                                        if(typeof data.data.newtab !== "undefined" && data.data.newtab !== "sametab"){
     10413                                            if ( 'newtab_hide' === data.data.newtab ) {
     10414                                                //hide if newtab redirect with hide form option selected
     10415                                                self.$el.hide();
     10416                                            }
     10417                                            //new tab redirection
     10418                                            window.open( self.decodeHtmlEntity( decodeURIComponent( data.data.url ) ), '_blank' );
     10419                                        } else {
     10420                                            //same tab redirection
     10421                                            window.location.href = self.decodeHtmlEntity( decodeURIComponent( data.data.url ) );
     10422                                        }
     10423
     10424                                    }
     10425
     10426                                    if (hideForm) {
     10427                                        self.$el.find('.forminator-row').hide();
     10428                                        self.$el.find('.forminator-pagination-steps').hide();
     10429                                        self.$el.find('.forminator-pagination-footer').hide();
     10430                                        self.$el.find('.forminator-pagination-steps, .forminator-pagination-progress').hide();
     10431                                    }
     10432                                }
     10433                            },
     10434                            error: function (err) {
     10435                                if ( 0 !== saveDraftBtn.length ) {
     10436                                    self.$el.find( 'input[name="save_draft"]' ).val( 'false' );
     10437                                    saveDraftBtn.addClass( 'disabled' );
     10438                                }
     10439
     10440                                $this.find('button').removeAttr('disabled');
     10441                                $target_message.html('');
     10442                                var $message = err.status === 400 ? window.ForminatorFront.cform.upload_error : window.ForminatorFront.cform.error;
     10443                                $target_message.html('<label class="forminator-label--notice"><span>' + $message + '</span></label>');
     10444                                self.focus_to_element($target_message);
     10445                                $this.trigger('forminator:form:submit:failed', [ formData, $message ] );
     10446                                self.multi_upload_disable( $this, false );
     10447                            },
     10448                            complete: function(xhr,status) {
     10449                                self.$el.find('.forminator-button-submit').removeClass('forminator-button-onload');
     10450
     10451                                $this.trigger('forminator:form:submit:complete', formData);
     10452
     10453                                self.showLeadsLoader( self );
     10454                            }
     10455                        }).always(function () {
     10456                            if( typeof self.settings.has_loader !== "undefined" && self.settings.has_loader ) {
     10457                                // Enable form fields
     10458                                self.$el.removeClass('forminator-fields-disabled forminator-partial-disabled');
     10459
     10460                                $target_message.removeClass('forminator-loading');
     10461                            }
     10462
     10463                            if ( 0 !== saveDraftBtn.length ) {
     10464                                self.$el.find( 'input[name="save_draft"]' ).val( 'false' );
     10465                                saveDraftBtn.addClass( 'disabled' );
     10466                            }
     10467
     10468                            self.disable_form_submit( self, false );
     10469                            $this.trigger('after:forminator:form:submit', formData);
     10470                        });
     10471                    } else {
     10472                        if( typeof self.settings.has_loader !== "undefined" && self.settings.has_loader ) {
     10473                            // Disable form fields
     10474                            self.$el.addClass('forminator-fields-disabled');
     10475
     10476                            $target_message.html('<p>' + self.settings.loader_label + '</p>');
     10477
     10478                            $target_message.removeAttr("aria-hidden")
     10479                                .prop("tabindex", "-1")
     10480                                .removeClass('forminator-success forminator-error forminator-accessible')
     10481                                .addClass('forminator-loading forminator-show');
     10482                        }
     10483
     10484                        submitEvent.currentTarget.submit();
     10485
     10486                        self.showLeadsLoader( self );
     10487                    }
     10488                };
     10489
     10490                // payment setup
     10491                var paymentIsHidden = self.$el.find('div[data-is-payment="true"]')
     10492                    .closest('.forminator-row, .forminator-col').hasClass('forminator-hidden');
     10493                if ( self.$el.data('forminatorFrontPayment') && ! paymentIsHidden && ! $saveDraft ) {
     10494                    setTimeout( function() {
     10495                        self.$el.trigger('payment.before.submit.forminator', [formData, function () {
     10496                            submitCallback.apply(thisForm);
     10497                        }]);
     10498                    }, 200 );
     10499                } else {
     10500                    submitCallback.apply(thisForm);
     10501                }
     10502
     10503                return false;
     10504            });
     10505
     10506        },
     10507
     10508        handle_submit_form_draft: function () {
     10509            var self = this;
     10510
     10511            $('body').on( 'click', '.forminator-save-draft-link', function (e) {
     10512                e.preventDefault();
     10513                e.stopPropagation();
     10514
     10515                var thisForm  = $( this ).closest( 'form' ),
     10516                    saveDraft = thisForm.find( 'input[name="save_draft"]' )
     10517                    ;
     10518
     10519                // prevent double clicks and clicking without any changes
     10520                if (
     10521                    thisForm.closest( '#forminator-modal' ).hasClass( 'preview' ) ||
     10522                    'true' === saveDraft.val() ||
     10523                    $( this ).hasClass( 'disabled' )
     10524                ) {
     10525                    return;
     10526                }
     10527
     10528                saveDraft.val( 'true' );
     10529                thisForm.trigger( 'submit.frontSubmit', 'draft_submit' );
     10530            });
     10531
     10532        },
     10533
     10534        showDraftLink: function( data ) {
     10535            var $form = this.$el;
     10536            $form.trigger( 'forminator:form:draft:success', data );
     10537            $form.find( '.forminator-response-message' ).html('');
     10538            $form.hide();
     10539
     10540            $( data.message ).insertBefore( $form );
     10541            this.sendDraftLink( data );
     10542        },
     10543
     10544        sendDraftLink: function( data ) {
     10545            var self = this,
     10546                sendDraftForm = '#send-draft-link-form-' + data.draft_id
     10547                ;
     10548
     10549            $( 'body' ).on( 'submit', sendDraftForm, function(e) {
     10550                var form          = $( this ),
     10551                    draftData     = new FormData(this),
     10552                    emailWrap     = form.find( '#email-1' ),
     10553                    emailField    = emailWrap.find( '.forminator-field' ),
     10554                    submit        = form.find( '.forminator-button-submit' ),
     10555                    targetMessage = form.find( '.forminator-response-message' ),
     10556                    emailResponse = form.prev( '.forminator-draft-email-response' );
     10557
     10558                if (
     10559                    $( this ).hasClass( 'submitting' ) ||
     10560                    ( $( this ).hasClass( 'forminator-has_error' ) && '' === emailWrap.find( 'input[name="email-1"]' ).val() )
     10561                ) {
     10562                    return false;
     10563                }
     10564
     10565                // Add submitting class and disable prop to prevent multi submissions
     10566                form.addClass( 'submitting' );
     10567                submit.attr( 'disabled', true );
     10568
     10569                // Reset if there's error
     10570                form.removeClass( 'forminator-has_error' );
     10571                emailField.removeClass( 'forminator-has_error' );
     10572                emailField.find( '.forminator-error-message' ).remove();
     10573
     10574                e.preventDefault();
     10575                $.ajax({
     10576                    type: 'POST',
     10577                    url: window.ForminatorFront.ajaxUrl,
     10578                    data: draftData,
     10579                    cache: false,
     10580                    contentType: false,
     10581                    processData: false,
     10582                    beforeSend: function () {
     10583                        form.trigger( 'before:forminator:draft:email:submit', draftData );
     10584                    },
     10585                    success: function( data ) {
     10586                        var res = data.data;
     10587                        if( ( ! data && 'undefined' !== typeof data ) || 'object' !== typeof res ) {
     10588                            submit.removeAttr( 'disabled' );
     10589                            targetMessage
     10590                                .addClass( 'forminator-error' )
     10591                                .html( '<p>' + window.ForminatorFront.cform.error + '<br>(' + res + ')</p>');
     10592                            self.focus_to_element( targetMessage );
     10593
     10594                            return false;
     10595                        }
     10596
     10597                        if (
     10598                            ! data.success &&
     10599                            undefined !== res.field &&
     10600                            'email-1' === res.field &&
     10601                            ! emailField.hasClass( 'forminator-has_error' )
     10602                        ) {
     10603                            form.addClass( 'forminator-has_error' );
     10604                            emailField.addClass( 'forminator-has_error' );
     10605                            emailField.append( '<span class="forminator-error-message" aria-hidden="true">' + res.message + '</span>' );
     10606                        }
     10607
     10608                        if ( data.success ) {
     10609                            if ( res.draft_mail_sent ) {
     10610                                emailResponse.removeClass( 'draft-error' ).addClass( 'draft-success' );
     10611                            } else {
     10612                                emailResponse.removeClass( 'draft-success' ).addClass( 'draft-error' );
     10613                            }
     10614
     10615                            emailResponse.html( res.draft_mail_message );
     10616                            emailResponse.show();
     10617                            form.hide();
     10618                        }
     10619                    },
     10620                    error: function( error ) {
     10621                        form.removeClass( 'submitting' );
     10622                        submit.removeAttr( 'disabled' );
     10623                    }
     10624                }).always( function() {
     10625                    form.removeClass( 'submitting' );
     10626                    submit.removeAttr( 'disabled' );
     10627                });
     10628
     10629                emailResponse.on( 'click', '.draft-resend-mail', function( e ) {
     10630                    e.preventDefault();
     10631
     10632                    emailResponse.slideUp( 50 );
     10633                    form.show();
     10634                });
     10635            } );
     10636        },
     10637
     10638        processCaptcha: function( self, e, $target_message ) {
     10639            var $captcha_field = self.$el.find('.forminator-g-recaptcha, .forminator-hcaptcha');
     10640
     10641            if ($captcha_field.length) {
     10642                //validate only first
     10643                $captcha_field = $($captcha_field.get(0));
     10644                var captcha_size  = $captcha_field.data('size'),
     10645                    $captcha_parent = $captcha_field.parent( '.forminator-col' );
     10646
     10647                // Recaptcha
     10648                if ( $captcha_field.hasClass( 'forminator-g-recaptcha' ) ) {
     10649                    var captcha_widget  = $captcha_field.data( 'forminator-recapchta-widget' );
     10650
     10651                    if ( 0 !== $captcha_field.children().length ) {
     10652                        var $captcha_response = window.grecaptcha.getResponse( captcha_widget );
     10653
     10654                        if ( captcha_size === 'invisible' ) {
     10655                            if ( $captcha_response.length === 0 ) {
     10656                                window.grecaptcha.execute( captcha_widget );
     10657                                return false;
     10658                            }
     10659                        }
     10660
     10661                        // reset after getResponse
     10662                        if ( self.$el.hasClass( 'forminator_ajax' ) && 'forminator:preSubmit:paypal' !== e.type ) {
     10663                            window.grecaptcha.reset(captcha_widget);
     10664                        }
     10665                    }
     10666
     10667                // Hcaptcha
     10668                } else if ( $captcha_field.hasClass( 'forminator-hcaptcha' ) ) {
     10669
     10670                    var captcha_widget   = $captcha_field.data( 'forminator-hcaptcha-widget' ),
     10671                        $captcha_response = hcaptcha.getResponse( captcha_widget );
     10672
     10673                    if ( captcha_size === 'invisible' ) {
     10674                        if ( $captcha_response.length === 0 ) {
     10675                            hcaptcha.execute( captcha_widget );
     10676                            return false;
     10677                        }
     10678                    }
     10679
     10680                    // reset after getResponse
     10681                    if ( self.$el.hasClass( 'forminator_ajax' ) && 'forminator:preSubmit:paypal' !== e.type ) {
     10682                        hcaptcha.reset( captcha_widget );
     10683                    }
     10684                }
     10685
     10686                $target_message.html('');
     10687                if ($captcha_field.hasClass("error")) {
     10688                    $captcha_field.removeClass("error");
     10689                }
     10690
     10691                if ( ! $captcha_response || $captcha_response.length === 0) {
     10692                    if (!$captcha_field.hasClass("error")) {
     10693                        $captcha_field.addClass("error");
     10694                    }
     10695
     10696                    $target_message.removeAttr("aria-hidden").html('<label class="forminator-label--error"><span>' + window.ForminatorFront.cform.captcha_error + '</span></label>');
     10697
     10698                    if ( ! self.settings.inline_validation ) {
     10699                        self.focus_to_element($target_message);
     10700                    } else {
     10701
     10702                        if ( ! $captcha_parent.hasClass( 'forminator-has_error' ) && $captcha_field.data( 'size' ) !== 'invisible' ) {
     10703                            $captcha_parent.addClass( 'forminator-has_error' )
     10704                                .append( '<span class="forminator-error-message" aria-hidden="true">' + window.ForminatorFront.cform.captcha_error + '</span>' );
     10705                            self.focus_to_element( $captcha_parent );
     10706                        }
     10707
     10708                    }
     10709
     10710                    return false;
     10711                }
     10712            }
     10713
     10714        },
     10715
     10716        hideForm: function( form ) {
     10717            form.css({
     10718                'height': 0,
     10719                'opacity': 0,
     10720                'overflow': 'hidden',
     10721                'visibility': 'hidden',
     10722                'pointer-events': 'none',
     10723                'margin': 0,
     10724                'padding': 0,
     10725                'border': 0,
     10726                'display': 'none',
     10727            });
     10728        },
     10729
     10730        showForm: function( form ) {
     10731            form.css({
     10732                'height': '',
     10733                'opacity': '',
     10734                'overflow': '',
     10735                'visibility': '',
     10736                'pointer-events': '',
     10737                'margin': '',
     10738                'padding': '',
     10739                'border': '',
     10740                'display': 'block',
     10741            });
     10742        },
     10743
     10744        showQuiz: function( form ) {
     10745            var quizForm = $('#forminator-module-' + this.settings.quiz_id ),
     10746                parent = $( '#forminator-quiz-leads-' + this.settings.quiz_id );
     10747
     10748            this.hideForm( form );
     10749            parent.find( '.forminator-lead-form-skip' ).hide();
     10750            if( 'undefined' !== typeof this.settings.form_placement && 'beginning' === this.settings.form_placement ) {
     10751                this.showForm( quizForm );
     10752                if ( quizForm.find('.forminator-pagination').length ) {
     10753                    parent.find( '.forminator-quiz-intro').hide();
     10754                    quizForm.prepend('<button class="forminator-button forminator-quiz-start forminator-hidden"></button>')
     10755                            .find('.forminator-quiz-start').trigger('click').remove();
     10756                }
     10757            }
     10758        },
     10759
     10760        handle_submit_quiz: function( data ) {
     10761
     10762            var self = this,
     10763                hasLeads = 'undefined' !== typeof self.settings.hasLeads ? self.settings.hasLeads : false,
     10764                leads_id = 'undefined' !== typeof self.settings.leads_id ? self.settings.leads_id : 0,
     10765                quiz_id = 'undefined' !== typeof self.settings.quiz_id ? self.settings.quiz_id : 0;
     10766
     10767            $( 'body' ).on( 'submit.frontSubmit', this.settings.forminator_selector, function( e ) {
     10768                if ( 0 !== self.$el.find( 'input[type="hidden"][value="forminator_submit_preview_form_quizzes"]' ).length ) {
     10769                    return false;
     10770                }
     10771                var form       = $(this),
     10772                    ajaxData   = [],
     10773                    formData   = new FormData( this ),
     10774                    answer     = form.find( '.forminator-answer' ),
     10775                    button     = self.$el.find('.forminator-button').last(),
     10776                    quizResult = self.$el.find( '.forminator-quiz--result' ),
     10777                    loadLabel  = button.data( 'loading' ),
     10778                    placement  = 'undefined' !== typeof self.settings.form_placement ? self.settings.form_placement : '',
     10779                    skip_form  = 'undefined' !== typeof self.settings.skip_form ? self.settings.skip_form : ''
     10780                    ;
     10781
     10782                e.preventDefault();
     10783                e.stopPropagation();
     10784
     10785                // Enable all inputs
     10786                self.$el.find( '.forminator-has-been-disabled' ).removeAttr( 'disabled' );
     10787
     10788                // Serialize fields, that should be placed here!
     10789                ajaxData = form.serialize();
     10790
     10791                // Disable inputs again
     10792                self.$el.find( '.forminator-has-been-disabled' ).attr( 'disabled', 'disabled' );
     10793
     10794                if( hasLeads ) {
     10795                    var entry_id  = '';
     10796                    if ( self.$el.find('input[name=entry_id]').length > 0 ) {
     10797                        entry_id = self.$el.find('input[name=entry_id]').val();
     10798                    }
     10799                    if( 'end' === placement && entry_id === '' ) {
     10800                        self.showForm( $('#forminator-module-' + leads_id ) );
     10801                        quizResult.addClass( 'forminator-hidden' );
     10802                        $('#forminator-quiz-leads-' + quiz_id + ' .forminator-lead-form-skip' ).show();
     10803
     10804                        return false;
     10805                    }
     10806
     10807                    if( ! skip_form && entry_id === '' ) {
     10808                        return false;
     10809                    }
     10810                }
     10811
     10812                // Add loading label.
     10813                if ( loadLabel !== '' ) {
     10814                    button.text( loadLabel );
     10815                }
     10816
     10817                if ( self.settings.has_quiz_loader ) {
     10818                    answer.each( function() {
     10819                        var answer = $( this ),
     10820                            input  = answer.find( 'input' ),
     10821                            status = answer.find( '.forminator-answer--status' ),
     10822                            loader = '<i class="forminator-icon-loader forminator-loading"></i>'
     10823                            ;
     10824
     10825                        if ( input.is( ':checked' ) ) {
     10826                            if ( 0 === status.html().length ) {
     10827                                status.html( loader );
     10828                            }
     10829                        }
     10830                    });
     10831                }
     10832
     10833                var pagination = !! self.$el.find('.forminator-pagination');
     10834
     10835                $.ajax({
     10836                    type: 'POST',
     10837                    url: window.ForminatorFront.ajaxUrl,
     10838                    data: ajaxData,
     10839                    beforeSend: function() {
     10840                        if ( ! pagination ) {
     10841                            self.$el.find( 'button' ).attr( 'disabled', 'disabled' );
     10842                        }
     10843                        form.trigger( 'before:forminator:quiz:submit', [ ajaxData, formData ] );
     10844                    },
     10845                    success: function( data ) {
     10846
     10847                        if ( data.success ) {
     10848                            var resultText = '';
     10849
     10850                            quizResult.removeClass( 'forminator-hidden' );
     10851                            window.history.pushState( 'forminator', 'Forminator', data.data.result_url );
     10852
     10853                            if ( data.data.type === 'nowrong' ) {
     10854                                resultText = data.data.result;
     10855
     10856                                quizResult.html( resultText );
     10857                                if ( ! pagination ) {
     10858                                    self.$el.find( '.forminator-answer input' ).attr( 'disabled', 'disabled' );
     10859                                }
     10860
     10861                            } else if ( data.data.type === 'knowledge' ) {
     10862                                resultText = data.data.finalText;
     10863
     10864                                if ( quizResult.length > 0 ) {
     10865                                    quizResult.html( resultText );
     10866                                }
     10867
     10868                                Object.keys( data.data.result ).forEach( function( key ) {
     10869
     10870                                    var responseClass,
     10871                                        responseIcon,
     10872                                        parent  = self.$el.find( '#' + key ),
     10873                                        result  = parent.find( '.forminator-question--result' ),
     10874                                        submit  = parent.find( '.forminator-submit-rightaway' ),
     10875                                        answers = parent.find( '.forminator-answer input' )
     10876                                        ;
     10877
     10878                                    // Check if selected answer is right or wrong.
     10879                                    if ( data.data.result[key].isCorrect ) {
     10880                                        responseClass = 'forminator-is_correct';
     10881                                        responseIcon  = '<i class="forminator-icon-check"></i>';
     10882                                    } else {
     10883                                        responseClass = 'forminator-is_incorrect';
     10884                                        responseIcon  = '<i class="forminator-icon-cancel"></i>';
     10885                                    }
     10886
     10887                                    // Show question result.
     10888                                    result.text( data.data.result[key].message );
     10889                                    result.addClass( 'forminator-show' );
     10890                                    submit.attr( 'disabled', true );
     10891                                    submit.attr( 'aria-disabled', true );
     10892
     10893                                    // Prevent user from changing answer.
     10894                                    answers.attr( 'disabled', true );
     10895                                    answers.attr( 'aria-disabled', true );
     10896
     10897                                    // For multiple answers per question
     10898                                    if ( undefined === data.data.result[key].answer ) {
     10899                                            var answersArray = data.data.result[key].answers;
     10900
     10901                                            for ( var $i = 0; $i < answersArray.length; $i++ ) {
     10902                                                    var answer = parent.find( '[id|="' + answersArray[$i].id + '"]' ).closest( '.forminator-answer' );
     10903
     10904                                                    // Check if selected answer is right or wrong.
     10905                                                    answer.addClass( responseClass );
     10906                                                    if ( 0 === answer.find( '.forminator-answer--status' ).html().length ) {
     10907                                                            answer.find( '.forminator-answer--status' ).html( responseIcon );
     10908                                                    } else {
     10909
     10910                                                            if ( 0 !== answer.find( '.forminator-answer--status .forminator-icon-loader' ).length ) {
     10911                                                                    answer.find( '.forminator-answer--status' ).html( responseIcon );
     10912                                                            }
     10913                                                    }
     10914                                            }
     10915
     10916                                    // For single answer per question
     10917                                    } else {
     10918                                            var answer = parent.find( '[id|="' + data.data.result[key].answer + '"]' ).closest( '.forminator-answer' );
     10919
     10920                                            // Check if selected answer is right or wrong.
     10921                                            answer.addClass( responseClass );
     10922                                            if ( 0 === answer.find( '.forminator-answer--status' ).html().length ) {
     10923                                                    answer.find( '.forminator-answer--status' ).html( responseIcon );
     10924                                            } else {
     10925
     10926                                                    if ( 0 !== answer.find( '.forminator-answer--status .forminator-icon-loader' ).length ) {
     10927                                                            answer.find( '.forminator-answer--status' ).html( responseIcon );
     10928                                                    }
     10929                                            }
     10930                                    }
     10931
     10932                                });
     10933                            }
     10934
     10935                            form.trigger( 'forminator:quiz:submit:success', [ ajaxData, formData, resultText ] ) ;
     10936
     10937                            if ( 0 !== quizResult.find( '.forminator-quiz--summary' ).length && ! quizResult.parent().hasClass( 'forminator-pagination--content' ) ) {
     10938                                self.focus_to_element( quizResult.find( '.forminator-quiz--summary' ) );
     10939                            }
     10940
     10941                        } else {
     10942                            self.$el.find( 'button' ).removeAttr( 'disabled' );
     10943
     10944                            form.trigger( 'forminator:quiz:submit:failed', [ ajaxData, formData ] );
     10945                        }
     10946                    }
     10947                }).always(function () {
     10948                    form.trigger('after:forminator:quiz:submit', [ ajaxData, formData ] );
     10949                    form.nextAll( '.leads-quiz-loader' ).remove();
     10950                });
     10951                return false;
     10952            });
     10953
     10954            $('body').on('click', '#forminator-quiz-leads-' + quiz_id + ' .forminator-lead-form-skip', function (e) {
     10955                self.showQuiz( $('#forminator-module-' + leads_id) );
     10956
     10957                if( 'undefined' !== typeof self.settings.form_placement && 'end' === self.settings.form_placement ) {
     10958                    self.settings.form_placement = 'skip';
     10959                    self.$el.submit();
     10960                }
     10961            });
     10962
     10963            $('body').on('click', '.forminator-result--retake', function (e) {
     10964                var pageId = self.$el.find('input[name="page_id"]').val();
     10965                var ajaxData = {
     10966                    action: 'forminator_reload_quiz',
     10967                    pageId: pageId,
     10968                    nonce: self.$el.find('input[name="forminator_nonce"]').val()
     10969                };
     10970
     10971                e.preventDefault();
     10972
     10973                $.post( window.ForminatorFront.ajaxUrl, ajaxData, function( response ) {
     10974                    if ( response.success == true && response.html ) {
     10975                        window.location.replace(response.html);
     10976                    }
     10977                } );
     10978            });
     10979        },
     10980
     10981        handle_submit_poll: function () {
     10982            var self = this,
     10983                poll_form = self.$el.html();
     10984
     10985            // Hide (success) response message
     10986            var success_available = self.$el.find( '.forminator-response-message' ).not( ':hidden' );
     10987
     10988            if ( success_available.length ) {
     10989
     10990                self.focus_to_element(
     10991                    self.$el.find( '.forminator-response-message' ),
     10992                    true
     10993                );
     10994            }
     10995
     10996            $( 'body' ).on( 'submit.frontSubmit', this.settings.forminator_selector, function (e) {
     10997                if ( 0 !== self.$el.find( 'input[type="hidden"][value="forminator_submit_preview_form_poll"]' ).length ) {
     10998                    return false;
     10999                }
     11000                var $this    = $( this ),
     11001                    formData  = new FormData( this ),
     11002                    ajaxData  = $this.serialize()
     11003                ;
     11004
     11005                var $response = self.$el.find( '.forminator-response-message' ),
     11006                    $options  = self.$el.find( 'fieldset' ),
     11007                    $submit   = self.$el.find( '.forminator-button' )
     11008                ;
     11009
     11010                function response_clean() {
     11011                    // Remove content
     11012                    $response.html( '' );
     11013
     11014                    // Remove all classes
     11015                    $response.removeClass( 'forminator-show' );
     11016                    $response.removeClass( 'forminator-error' );
     11017                    $response.removeClass( 'forminator-success' );
     11018
     11019                    // Hide for screen readers
     11020                    $response.removeAttr( 'tabindex' );
     11021                    $response.attr( 'aria-hidden', true );
     11022
     11023                    // Remove options error class
     11024                    $options.removeClass( 'forminator-has_error' );
     11025
     11026                }
     11027
     11028                function response_message( message, custom_class ) {
     11029
     11030                    // Print message
     11031                    $response.html( '<p>' + message + '</p>' );
     11032
     11033                    // Add necessary classes
     11034                    $response.addClass( 'forminator-' + custom_class );
     11035                    $response.addClass( 'forminator-show' );
     11036
     11037                    // Show for screen readers
     11038                    $response.removeAttr( 'aria-hidden' );
     11039                    $response.attr( 'tabindex', '-1' );
     11040
     11041                    // Focus message
     11042                    $response.focus();
     11043
     11044                    // Add options error class
     11045                    if ( 'error' === custom_class ) {
     11046
     11047                        if ( ! $options.find( 'input[type="radio"]' ).is( ':checked' ) ) {
     11048                            $options.addClass( 'forminator-has_error' );
     11049                        }
     11050                    }
     11051                }
     11052
     11053                if ( self.$el.hasClass( 'forminator_ajax' ) ) {
     11054                    response_clean();
     11055
     11056                    $.ajax({
     11057                        type: 'POST',
     11058                        url:  window.ForminatorFront.ajaxUrl,
     11059                        data: ajaxData,
     11060
     11061                        beforeSend: function() {
     11062
     11063                            // Animate "submit" button
     11064                            $submit.addClass( 'forminator-onload' );
     11065
     11066                            // Trigger "submit" action
     11067                            $this.trigger( 'before:forminator:poll:submit', [ ajaxData, formData ] );
     11068
     11069                        },
     11070
     11071                        success: function( data ) {
     11072
     11073                            var $label_class = data.success ? 'success' : 'error';
     11074
     11075                            // Stop "submit" animation
     11076                            $submit.removeClass( 'forminator-onload' );
     11077
     11078                            if ( false === data.success ) {
     11079
     11080                                // Print message
     11081                                response_message( data.data.message, $label_class );
     11082
     11083                                // Failed response
     11084                                $this.trigger( 'forminator:poll:submit:failed', [ ajaxData, formData ] );
     11085
     11086                            } else {
     11087
     11088                                if ( 'undefined' !== typeof data.data ) {
     11089
     11090                                    $label_class = data.data.success ? 'success' : 'error';
     11091
     11092                                    // Print message
     11093                                    response_message( data.data.message, $label_class );
     11094
     11095                                    // Auto close message
     11096                                    setTimeout( function() {
     11097                                        response_clean();
     11098                                    }, 2500 );
     11099
     11100                                }
     11101                            }
     11102
     11103                            if ( true === data.success ) {
     11104
     11105                                if ( typeof data.data.url !== 'undefined' ) {
     11106                                    window.location.href = data.data.url;
     11107                                } else {
     11108
     11109                                    // url not exist, it will render chart on the fly if chart_data exist on response
     11110                                    // check length is > 1, because [0] is header
     11111                                    if ( typeof data.data.chart_data !== 'undefined' && data.data.chart_data.length > 1 ) {
     11112
     11113                                        if ( 'link_on' === data.data.results_behav ) {
     11114
     11115                                            if ( $this.find( '.forminator-note' ).length ) {
     11116                                                $this.find( '.forminator-note' ).remove();
     11117                                                $this.find( '.forminator-poll-footer' ).append( data.data.results_link );
     11118                                            }
     11119                                        }
     11120
     11121                                        if ( 'show_after' === data.data.results_behav ) {
     11122
     11123                                            self.render_poll_chart(
     11124                                                data.data.chart_data,
     11125                                                data.data.back_button,
     11126                                                self,
     11127                                                poll_form,
     11128                                                [
     11129                                                    data.data.votes_text,
     11130                                                    data.data.votes_count,
     11131                                                    [
     11132                                                        data.data.grids_color,
     11133                                                        data.data.labels_color,
     11134                                                        data.data.onchart_label
     11135                                                    ],
     11136                                                    [
     11137                                                        data.data.tooltips_bg,
     11138                                                        data.data.tooltips_color
     11139                                                    ]
     11140                                                ]
     11141                                            );
     11142
     11143                                        }
     11144                                    }
     11145                                }
     11146
     11147                                // Success response
     11148                                $this.trigger( 'forminator:poll:submit:success', [ ajaxData, formData ] );
     11149
     11150                            }
     11151                        },
     11152
     11153                        error: function() {
     11154
     11155                            response_clean();
     11156
     11157                            // Stop "submit" animation
     11158                            $submit.removeClass( '.forminator-onload' );
     11159
     11160                            // Failed response
     11161                            $this.trigger( 'forminator:poll:submit:failed', [ ajaxData, formData ] );
     11162
     11163                        }
     11164                    }).always( function() {
     11165
     11166                        $this.trigger( 'after:forminator:poll:submit', [ ajaxData, formData ] );
     11167
     11168                    });
     11169
     11170                    return false;
     11171
     11172                }
     11173
     11174                return true;
     11175
     11176            });
     11177        },
     11178
     11179        render_poll_chart: function( chart_data, back_button, forminatorSubmit, poll_form, chart_extras ) {
     11180            var pollId      = forminatorSubmit.$el.attr( 'id' ) + '-' + forminatorSubmit.$el.data('forminatorRender'),
     11181                chartId     = 'forminator-chart-poll-' + pollId,
     11182                pollBody    = forminatorSubmit.$el.find( '.forminator-poll-body' ),
     11183                pollFooter  = forminatorSubmit.$el.find( '.forminator-poll-footer' )
     11184                ;
     11185
     11186            function chart_clean() {
     11187
     11188                var canvas = forminatorSubmit.$el.find( '.forminator-chart-wrapper' ),
     11189                    wrapper = forminatorSubmit.$el.find( '.forminator-chart' )
     11190                    ;
     11191
     11192                canvas.remove();
     11193                wrapper.remove();
     11194
     11195            }
     11196
     11197            function chart_create() {
     11198                var canvas = $( '<canvas id="' + chartId + '" class="forminator-chart" role="img" aria-hidden="true"></canvas>' );
     11199
     11200                pollBody.append( canvas );
     11201            }
     11202
     11203            function chart_show() {
     11204                var canvas = forminatorSubmit.$el.find( '.forminator-chart' ),
     11205                    wrapper = forminatorSubmit.$el.find( '.forminator-chart-wrapper' )
     11206                    ;
     11207
     11208                if ( wrapper.length ) {
     11209
     11210                    // Show canvas
     11211                    canvas.addClass( 'forminator-show' );
     11212
     11213                    // Show wrapper
     11214                    wrapper.addClass( 'forminator-show' );
     11215                    wrapper.removeAttr( 'aria-hidden' );
     11216                    wrapper.attr( 'tabindex', '-1' );
     11217
     11218                    // Focus message
     11219                    wrapper.focus();
     11220                } else {
     11221                    // Fallback text
     11222                    canvas.html( '<p>Fallback text...</p>' );
     11223
     11224                    // Show canvas
     11225                    canvas.addClass( 'forminator-show' );
     11226                    canvas.removeAttr( 'aria-hidden' );
     11227                    canvas.attr( 'tabindex', '-1' );
     11228
     11229                    // Focus message
     11230                    canvas.focus();
     11231                }
     11232            }
     11233
     11234            function hide_answers() {
     11235                var answers = pollBody.find( '.forminator-field' );
     11236
     11237                answers.hide();
     11238                answers.attr( 'aria-hidden', 'true' );
     11239            }
     11240
     11241            function replace_footer() {
     11242
     11243                var button = $( back_button );
     11244
     11245                pollFooter.empty();
     11246                pollFooter.append( button );
     11247
     11248            }
     11249
     11250            function back_to_poll() {
     11251
     11252                var button = forminatorSubmit.$el.find( '.forminator-button' );
     11253
     11254                button.click( function( e ) {
     11255
     11256                    if ( forminatorSubmit.$el.hasClass( 'forminator_ajax' ) ) {
     11257                        forminatorSubmit.$el.html( poll_form );
     11258                    } else {
     11259                        location.reload();
     11260                    }
     11261
     11262                    e.preventDefault();
     11263
     11264                });
     11265            }
     11266
     11267            // Remove previously chart if exists
     11268            chart_clean();
     11269
     11270            // Create chart markup
     11271            chart_create();
     11272
     11273            // Load chart
     11274            FUI.pollChart(
     11275                '#' + chartId,
     11276                chart_data,
     11277                forminatorSubmit.settings.chart_design,
     11278                chart_extras
     11279            );
     11280
     11281            // Hide poll answers
     11282            hide_answers();
     11283
     11284            // Show poll chart
     11285            chart_show();
     11286
     11287            // Replace footer
     11288            replace_footer();
     11289            back_to_poll();
     11290
     11291        },
     11292
     11293        focus_to_element: function ( $element, not_scroll, fadeout, fadeout_time ) {
     11294            fadeout = fadeout || false;
     11295            fadeout_time = fadeout_time || 0;
     11296            not_scroll = not_scroll || false;
     11297            var parent_selector = 'html,body';
     11298
     11299            // check inside sui modal
     11300            if ( $element.closest( '.sui-dialog' ).length > 0 ) {
     11301                parent_selector = '.sui-dialog';
     11302            }
     11303
     11304            // check inside hustle modal (prioritize)
     11305            if ( $element.closest( '.wph-modal' ).length > 0 ) {
     11306                parent_selector = '.wph-modal';
     11307            }
     11308
     11309            // if element is not forminator textarea, force show in case its hidden of fadeOut
     11310            if ( ! $element.hasClass( 'forminator-textarea' ) && ! $element.parent( '.wp-editor-container' ).length ) {
     11311                $element.show();
     11312            } else if ( $element.hasClass( 'forminator-textarea' ) && $element.parent( '.wp-editor-container' ).length ) {
     11313                $element = $element.parent( '.wp-editor-container' );
     11314            }
     11315
     11316            function focusElement( $element ) {
     11317                if ( ! $element.attr("tabindex") ) {
     11318                    $element.attr("tabindex", -1);
     11319                }
     11320
     11321                if ( ! $element.hasClass( 'forminator-select2' ) ) {
     11322                    $element.focus();
     11323                }
     11324
     11325                if (fadeout) {
     11326                    $element.show().delay( fadeout_time ).fadeOut('slow');
     11327                }
     11328            }
     11329
     11330            if ( not_scroll ) {
     11331                focusElement($element);
     11332            } else {
     11333                $( parent_selector ).animate({scrollTop: ($element.offset().top - ($(window).height() - $element.outerHeight(true)) / 2)}, 500, function () {
     11334                    focusElement($element);
     11335                });
     11336            }
     11337        },
     11338
     11339        show_messages: function( errors ) {
     11340            var self = this,
     11341                forminatorFrontCondition = self.$el.data('forminatorFrontCondition');
     11342            if (typeof forminatorFrontCondition !== 'undefined') {
     11343
     11344                // clear all validation message before show new one
     11345                this.$el.find('.forminator-error-message').remove();
     11346                var i = 0;
     11347
     11348                errors.forEach( function( value ) {
     11349
     11350                    var elementId  = Object.keys( value ),
     11351                        getElement = forminatorFrontCondition.get_form_field( elementId )
     11352                        ;
     11353
     11354                    var holder          = $( getElement ),
     11355                        holderField     = holder.closest( '.forminator-field' ),
     11356                        holderDate      = holder.closest( '.forminator-date-input' ),
     11357                        holderTime      = holder.closest( '.forminator-timepicker' ),
     11358                        holderError     = '',
     11359                        getColumn       = false,
     11360                        getError        = false,
     11361                        getDesc         = false,
     11362                        errorId         = holder.attr('id') + '-error',
     11363                        ariaDescribedby = holder.attr('aria-describedby')
     11364                        ;
     11365
     11366                    var errorMessage = Object.values( value ),
     11367                        errorMarkup  = '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     11368                        ;
     11369
     11370                    if ( getElement.length ) {
     11371
     11372                        // Focus on first error
     11373                        if ( i === 0 ) {
     11374                            self.$el.trigger( 'forminator.front.pagination.focus.input', [getElement]);
     11375                            self.focus_to_element( getElement );
     11376                        }
     11377
     11378                        // CHECK: Timepicker field.
     11379                        if ( holderDate.length > 0 ) {
     11380
     11381                            getColumn = holderDate.parent();
     11382                            getError  = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     11383                            getDesc   = getColumn.find( '.forminator-description' );
     11384
     11385                            errorMarkup = '<span class="forminator-error-message" data-error-field="' + holder.data( 'field' ) + '" id="'+ errorId +'"></span>';
     11386
     11387                            if ( 0 === getError.length ) {
     11388
     11389                                if ( 'day' === holder.data( 'field' ) ) {
     11390
     11391                                    if ( getColumn.find( '.forminator-error-message[data-error-field="year"]' ).length ) {
     11392
     11393                                        $( errorMarkup ).insertBefore( getColumn.find( '.forminator-error-message[data-error-field="year"]' ) );
     11394
     11395                                    } else {
     11396
     11397                                        if ( 0 === getDesc.length ) {
     11398                                            getColumn.append( errorMarkup );
     11399                                        } else {
     11400                                            $( errorMarkup ).insertBefore( getDesc );
     11401                                        }
     11402                                    }
     11403
     11404                                    if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     11405
     11406                                        holderField.append(
     11407                                            '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     11408                                        );
     11409                                    }
     11410                                }
     11411
     11412                                if ( 'month' === holder.data( 'field' ) ) {
     11413
     11414                                    if ( getColumn.find( '.forminator-error-message[data-error-field="day"]' ).length ) {
     11415
     11416                                        $( errorMarkup ).insertBefore(
     11417                                            getColumn.find( '.forminator-error-message[data-error-field="day"]' )
     11418                                        );
     11419
     11420                                    } else {
     11421
     11422                                        if ( 0 === getDesc.length ) {
     11423                                            getColumn.append( errorMarkup );
     11424                                        } else {
     11425                                            $( errorMarkup ).insertBefore( getDesc );
     11426                                        }
     11427                                    }
     11428
     11429                                    if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     11430
     11431                                        holderField.append(
     11432                                            '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     11433                                        );
     11434                                    }
     11435                                }
     11436
     11437                                if ( 'year' === holder.data( 'field' ) ) {
     11438
     11439                                    if ( 0 === getDesc.length ) {
     11440                                        getColumn.append( errorMarkup );
     11441                                    } else {
     11442                                        $( errorMarkup ).insertBefore( getDesc );
     11443                                    }
     11444
     11445                                    if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     11446
     11447                                        holderField.append(
     11448                                            '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     11449                                        );
     11450                                    }
     11451                                }
     11452                            }
     11453
     11454                            holderError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     11455
     11456                            // Insert error message
     11457                            holderError.html( errorMessage );
     11458                            holderField.find( '.forminator-error-message' ).html( errorMessage );
     11459
     11460                        } else if ( holderTime.length > 0 && errorMessage[0].length > 0 ) {
     11461
     11462                            getColumn = holderTime.parent();
     11463                            getError  = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     11464                            getDesc   = getColumn.find( '.forminator-description' );
     11465
     11466                            errorMarkup = '<span class="forminator-error-message" data-error-field="' + holder.data( 'field' ) + '" id="'+ errorId +'"></span>';
     11467
     11468                            if ( 0 === getError.length ) {
     11469
     11470                                if ( 'hours' === holder.data( 'field' ) ) {
     11471
     11472                                    if ( getColumn.find( '.forminator-error-message[data-error-field="minutes"]' ).length ) {
     11473
     11474                                        $( errorMarkup ).insertBefore(
     11475                                            getColumn.find( '.forminator-error-message[data-error-field="minutes"]' )
     11476                                        );
     11477                                    } else {
     11478
     11479                                        if ( 0 === getDesc.length ) {
     11480                                            getColumn.append( errorMarkup );
     11481                                        } else {
     11482                                            $( errorMarkup ).insertBefore( getDesc );
     11483                                        }
     11484                                    }
     11485
     11486                                    if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     11487
     11488                                        holderField.append(
     11489                                            '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     11490                                        );
     11491                                    }
     11492                                }
     11493
     11494                                if ( 'minutes' === holder.data( 'field' ) ) {
     11495
     11496                                    if ( 0 === getDesc.length ) {
     11497                                        getColumn.append( errorMarkup );
     11498                                    } else {
     11499                                        $( errorMarkup ).insertBefore( getDesc );
     11500                                    }
     11501
     11502                                    if ( 0 === holderField.find( '.forminator-error-message' ).length ) {
     11503
     11504                                        holderField.append(
     11505                                            '<span class="forminator-error-message" id="'+ errorId +'"></span>'
     11506                                        );
     11507                                    }
     11508                                }
     11509                            }
     11510
     11511                            holderError = getColumn.find( '.forminator-error-message[data-error-field="' + holder.data( 'field' ) + '"]' );
     11512
     11513                            // Insert error message
     11514                            holderError.html( errorMessage );
     11515                            holderField.find( '.forminator-error-message' ).html( errorMessage );
     11516
     11517                        } else {
     11518
     11519                            var getError = holderField.find( '.forminator-error-message' ),
     11520                                getDesc  = holderField.find( '.forminator-description' )
     11521                                ;
     11522
     11523                            if ( 0 === getError.length ) {
     11524
     11525                                if ( 0 === getDesc.length ) {
     11526                                    holderField.append( errorMarkup );
     11527                                } else {
     11528                                    $( errorMarkup ).insertBefore( getDesc );
     11529                                }
     11530                            }
     11531
     11532                            holderError = holderField.find( '.forminator-error-message' );
     11533
     11534                            // Insert error message
     11535                            holderError.html( errorMessage );
     11536
     11537                        }
     11538
     11539                        // Field aria describedby for screen readers
     11540                        if (ariaDescribedby) {
     11541                            var ids = ariaDescribedby.split(' ');
     11542                            var errorIdExists = ids.includes(errorId);
     11543                            if (!errorIdExists) {
     11544                                ids.push(errorId);
     11545                            }
     11546                            var updatedAriaDescribedby = ids.join(' ');
     11547                            holder.attr('aria-describedby', updatedAriaDescribedby);
     11548                        } else {
     11549                            holder.attr('aria-describedby', errorId);
     11550                        }
     11551
     11552                        // Field invalid status for screen readers
     11553                        holder.attr( 'aria-invalid', 'true' );
     11554
     11555                        // Field error status
     11556                        holderField.addClass( 'forminator-has_error' );
     11557
     11558                        i++;
     11559
     11560                    }
     11561                });
     11562            }
     11563
     11564            return this;
     11565        },
     11566
     11567        multi_upload_disable: function ( $form, disable ) {
     11568            $form.find( '.forminator-multi-upload input' ).each( function() {
     11569                var file_method = $(this).data('method');
     11570                if( 'ajax' === file_method ) {
     11571                    $(this).attr('disabled', disable);
     11572                }
     11573            });
     11574        },
     11575
     11576        disable_form_submit: function ( form, disable  ) {
     11577            form.$el.find( '.forminator-button-submit' ).prop( 'disabled', disable );
     11578        },
     11579
     11580        showLeadsLoader: function ( quiz  ) {
     11581            if( quiz.settings.hasLeads && 'end' === quiz.settings.form_placement ) {
     11582                $( '#forminator-quiz-leads-' + quiz.settings.quiz_id )
     11583                .append(
     11584                    '<div class="leads-quiz-loader forminator-response-message">' +
     11585                    '<i class="forminator-icon-loader forminator-loading" ' +
     11586                    'aria-hidden="true"></i>' +
     11587                    '<style>.leads-quiz-loader{padding:20px;text-align:center;}.leads-quiz-loader .forminator-loading:before{display:block;}</style>' +
     11588                    '</div>'
     11589                );
     11590            }
     11591        }
     11592
     11593    });
     11594
     11595    // A really lightweight plugin wrapper around the constructor,
     11596    // preventing against multiple instantiations
     11597    $.fn[pluginName] = function (options) {
     11598        return this.each(function () {
     11599            if (!$.data(this, pluginName)) {
     11600                $.data(this, pluginName, new ForminatorFrontSubmit(this, options));
     11601            }
     11602        });
     11603    };
     11604
     11605})(jQuery, window, document);
     11606
     11607// the semi-colon before function invocation is a safety net against concatenated
     11608// scripts and/or other plugins which may not be closed properly.
     11609;// noinspection JSUnusedLocalSymbols
     11610(function ($, window, document, undefined) {
     11611
     11612    "use strict";
     11613
     11614    // undefined is used here as the undefined global variable in ECMAScript 3 is
     11615    // mutable (ie. it can be changed by someone else). undefined isn't really being
     11616    // passed in so we can ensure the value of it is truly undefined. In ES5, undefined
     11617    // can no longer be modified.
     11618
     11619    // window and document are passed through as local variables rather than global
     11620    // as this (slightly) quickens the resolution process and can be more efficiently
     11621    // minified (especially when both are regularly referenced in your plugin).
     11622
     11623    // Create the defaults once
     11624    var pluginName = "forminatorFrontMultiFile",
     11625        defaults = {};
     11626
     11627    // The actual plugin constructor
     11628    function ForminatorFrontMultiFile(element, options) {
     11629        this.element = element;
     11630        this.$el = $(this.element);
     11631
     11632        // jQuery has an extend method which merges the contents of two or
     11633        // more objects, storing the result in the first object. The first object
     11634        // is generally empty as we don't want to alter the default options for
     11635        // future instances of the plugin
     11636        this.form = $.extend({}, defaults, options);
     11637        this._defaults = defaults;
     11638        this._name = pluginName;
     11639        this.form_id = 0;
     11640        this.uploader = this.$el;
     11641        this.element = this.uploader.data('element');
     11642
     11643        this.init();
     11644    }
     11645
     11646    // Avoid Plugin.prototype conflicts
     11647    $.extend(ForminatorFrontMultiFile.prototype, {
     11648        init: function () {
     11649            var self = this,
     11650                fileList = [],
     11651                ajax_request = [];
     11652
     11653            if (this.form.find('input[name=form_id]').length > 0) {
     11654                this.form_id = this.form.find('input[name=form_id]').val();
     11655            }
     11656
     11657            this.uploader.on("drag dragstart dragend dragover dragenter dragleave drop", function(e) {
     11658                e.preventDefault();
     11659                e.stopPropagation();
     11660            });
     11661            this.uploader.on("dragover dragenter", function(a) {
     11662                $(this).addClass("forminator-dragover");
     11663            });
     11664            this.uploader.on("dragleave dragend drop", function(a) {
     11665                $(this).removeClass("forminator-dragover");
     11666            });
     11667            this.uploader.find( ".forminator-upload-file--forminator-field-" + this.element ).on("click", function(e) {
     11668                self.form.find( '.forminator-field-' + self.element + '-' + self.form_id ).click();
     11669            });
     11670
     11671            this.uploader.on("drop", function(e) {
     11672                document.querySelector( '.forminator-field-' + self.element + '-' + self.form_id ).files = e.originalEvent.dataTransfer.files;
     11673                self.form.find( '.forminator-field-' + self.element + '-' + self.form_id ).change();
     11674            });
     11675
     11676            this.uploader.on("click", function(e) {
     11677                if ( e.target === e.currentTarget ) {
     11678                    self.form.find( '.forminator-field-' + self.element + '-' + self.form_id ).click();
     11679                }
     11680            });
     11681            this.uploader.find('.forminator-multi-upload-message, .forminator-multi-upload-message p, .forminator-multi-upload-message .forminator-icon-upload').on("click", function(e) {
     11682                if ( e.target === e.currentTarget ) {
     11683                    self.form.find( '.forminator-field-' + self.element + '-' + self.form_id ).click();
     11684                }
     11685            });
     11686
     11687            this.form.on("forminator:form:submit:success", function(e) {
     11688                fileList = [];
     11689            });
     11690            this.form.find( '.forminator-field-' + self.element + '-' + self.form_id ).on("change", function(e) {
     11691                if( ! self.uploadingFile ){
     11692                    self.uploadingFile = 1;
     11693
     11694                    var $this = $(this),
     11695                        param = this.files,
     11696                        uploadParam = [];
     11697
     11698                    $.when().then(function(){
     11699                        $this.closest('.forminator-field').removeClass('forminator-has_error');
     11700                        for ( var i = 0; i < param.length; i++ ) {
     11701                            uploadParam.push( param[ i ] );
     11702                            fileList.push( param[ i ] );
     11703                        }
     11704
     11705                        ajax_request = self.handleChangeCallback( uploadParam, $this, ajax_request );
     11706                        var file_list = Array.prototype.slice.call( fileList );
     11707
     11708                        if ( file_list.length > 0 ) {
     11709                            param = self.FileObjectItem(file_list);
     11710                            if ( 'submission' === $this.data( 'method' ) ) {
     11711                                $this.prop( 'files', param );
     11712                            }
     11713                        }
     11714                    }).done(function(){
     11715                        self.uploadingFile = null;
     11716                    });
     11717                }
     11718            });
     11719
     11720            this.delete_files( fileList, ajax_request );
     11721        },
     11722
     11723        /**
     11724         * Upload Ajax call
     11725         *
     11726         * @param param
     11727         * @param $this
     11728         * @param ajax_request
     11729         */
     11730        handleChangeCallback: function ( param, $this, ajax_request ) {
     11731            var self = this,
     11732                ajax_inc = 0,
     11733                uploadData = new FormData,
     11734                nonce = this.form.find('input[name="forminator_nonce"]').val(),
     11735                method = $this.data('method'),
     11736                elementId = self.element;
     11737
     11738            elementId = elementId.split('_')[0];
     11739            uploadData.append( "action", "forminator_multiple_file_upload" );
     11740            uploadData.append( "form_id", this.form_id );
     11741            uploadData.append( "element_id", elementId );
     11742            uploadData.append( "nonce", nonce );
     11743
     11744            $.each( param, function ( i, item ) {
     11745                var unique_id = self.progress_bar( item, method ),
     11746                    totalFile = self.form.find('.upload-container-' + self.element + ' li').length,
     11747                    fileType = 'undefined' !== typeof $this.data('filetype') ? $this.data('filetype') : '',
     11748                    file_reg = new RegExp("(.*?)\.("+ fileType +")$"),
     11749                    itemName = item.name.toLowerCase();
     11750                if ( 'undefined' !== typeof $this.data('size') && $this.data('size') <= item.size ) {
     11751                    error_messsage = $this.data('size-message');
     11752                    self.upload_fail_response( unique_id, error_messsage );
     11753                    return;
     11754                } else if( ! file_reg.test( itemName ) ) {
     11755                    var ext = itemName.split('.').pop();
     11756                    error_messsage = '.' + ext + ' ' + $this.data('filetype-message');
     11757                    self.upload_fail_response( unique_id, error_messsage );
     11758                    return;
     11759                }
     11760                if( 'ajax' === method ) {
     11761                    uploadData.delete( self.element );
     11762                    uploadData.delete( 'totalFiles' );
     11763                    uploadData.append( "totalFiles", totalFile );
     11764                    uploadData.append( elementId, item );
     11765                    ajax_request.push( $.ajax({
     11766                        xhr: function () {
     11767                            var xhr = new window.XMLHttpRequest();
     11768                            xhr.upload.addEventListener("progress", function (evt) {
     11769                                if (evt.lengthComputable) {
     11770                                    var percentComplete = ( ( evt.loaded / evt.total ) * 100 );
     11771                                    if( 90 > percentComplete ) {
     11772                                        self.form.find('#' + unique_id + ' .progress-percentage')
     11773                                            .html(Math.round(percentComplete) + '% of ');
     11774                                    }
     11775                                }
     11776                            }, false);
     11777                            return xhr;
     11778                        },
     11779                        type: 'POST',
     11780                        url: window.ForminatorFront.ajaxUrl,
     11781                        data: uploadData,
     11782                        cache: false,
     11783                        contentType: false,
     11784                        processData: false,
     11785                        beforeSend: function () {
     11786                            self.form.find('.forminator-button-submit').attr( 'disabled', true );
     11787                            self.$el.trigger('before:forminator:multiple:upload', uploadData);
     11788                        },
     11789                        success: function (data) {
     11790                            var element = self.element,
     11791                                current_file = {
     11792                                    success: data.success,
     11793                                    message: 'undefined' !== data.data.message ? data.data.message : '',
     11794                                    file_id: unique_id,
     11795                                    file_name: 'undefined' !== typeof data.data.file_url ? data.data.file_url.replace(/^.*[\\\/]/, '') : item.name,
     11796                                    mime_type: item.type,
     11797                                };
     11798                            self.add_upload_file( element, current_file );
     11799                            if ( true === data.success && true === data.data.success && 'undefined' !== typeof data.data ) {
     11800                                self.upload_success_response( unique_id );
     11801                                self.$el.trigger('success:forminator:multiple:upload', uploadData);
     11802                            } else {
     11803                                self.upload_fail_response( unique_id, data.data.message );
     11804                                if( 'undefined' !== typeof data.data.error_type && 'limit' === data.data.error_type ) {
     11805                                    self.form.find('#' + unique_id).addClass('forminator-upload-limit_error');
     11806                                }
     11807                                self.$el.trigger('fail:forminator:multiple:upload', uploadData);
     11808                            }
     11809                        },
     11810                        complete: function (xhr, status) {
     11811                            ajax_inc++;
     11812                            if ( param.length === ajax_inc ) {
     11813                                self.form.find('.forminator-button-submit').attr( 'disabled', false );
     11814                            }
     11815                            self.$el.trigger('complete:forminator:multiple:upload', uploadData);
     11816                        },
     11817                        error: function (err) {
     11818                            self.upload_fail_response( unique_id, window.ForminatorFront.cform.process_error );
     11819                        }
     11820                    }))
     11821                } else {
     11822                    var has_error = true,
     11823                        error_messsage = window.ForminatorFront.cform.process_error;
     11824
     11825                    if( 'undefined' !== typeof $this.data('limit') && $this.data('limit') < totalFile ) {
     11826                        has_error = false;
     11827                        self.form.find('#' + unique_id).addClass('forminator-upload-limit_error');
     11828                        error_messsage = $this.data('limit-message');
     11829                    }
     11830
     11831                    if( ! has_error ) {
     11832                        self.upload_fail_response( unique_id, error_messsage );
     11833
     11834                    } else {
     11835                        self.upload_success_response( unique_id );
     11836                    }
     11837                }
     11838            });
     11839
     11840            return ajax_request;
     11841        },
     11842
     11843        /**
     11844         * Ajax fail response
     11845         *
     11846         * @param unique_id
     11847         * @param message
     11848         */
     11849        upload_fail_response: function( unique_id, message ) {
     11850            this.form.trigger( 'validation:error' );
     11851            this.form.find('#' + unique_id).addClass('forminator-has_error');
     11852            this.form.find('#' + unique_id).find('.forminator-uploaded-file--size [class*="forminator-icon-"]')
     11853                .addClass('forminator-icon-warning')
     11854                .removeClass('forminator-icon-loader')
     11855                .removeClass('forminator-loading');
     11856            this.form.find('#' + unique_id + ' .progress-percentage').html('0% of ');
     11857            this.form.find('#' + unique_id + ' .forminator-uploaded-file--content')
     11858                .after('<div class="forminator-error-message">' + message + '</div>');
     11859        },
     11860
     11861        /**
     11862         * Ajax success response
     11863         *
     11864         * @param unique_id
     11865         */
     11866        upload_success_response: function( unique_id ) {
     11867            this.form.find('#' + unique_id + ' .progress-percentage').html('100% of ');
     11868            this.form.find('#' + unique_id + ' .forminator-uploaded-file--size [class*="forminator-icon-"]').remove();
     11869            this.form.find('#' + unique_id + ' .progress-percentage').remove();
     11870        },
     11871
     11872        /**
     11873         * Show progress bar
     11874         *
     11875         * @param file
     11876         * @param method
     11877         */
     11878        progress_bar: function( file, method ) {
     11879            var self = this,
     11880                uniqueID = Math.random().toString( 36 ).substr( 2, 7 ),
     11881                uniqueId = 'upload-process-' + uniqueID,
     11882                filename = file.name,
     11883                filesize = self.bytes_to_size( file.size, 2 ),
     11884                wrapper  = this.uploader.closest( '.forminator-field' ).find( '.forminator-uploaded-files' ),
     11885                markup   = ''
     11886            ;
     11887
     11888            this.progress_image_preview( file, uniqueId );
     11889
     11890            function getFileExtension( element ) {
     11891                var parts = element.split( '.' );
     11892                return parts[ parts.length - 1 ];
     11893            }
     11894
     11895            function isImage( element ) {
     11896
     11897                var ext = getFileExtension( element );
     11898
     11899                switch ( ext.toLowerCase() ) {
     11900                    case 'jpg':
     11901                    case 'jpe':
     11902                    case 'jpeg':
     11903                    case 'png':
     11904                    case 'gif':
     11905                    case 'ico':
     11906                        return true;
     11907                }
     11908
     11909                return false;
     11910
     11911            }
     11912
     11913            /**
     11914             * File Preview Markup.
     11915             *
     11916             * Get the icon file or replace it with image preview.
     11917             */
     11918            var preview = '<div class="forminator-uploaded-file--preview" aria-hidden="true">' +
     11919                '<span class="forminator-icon-file" aria-hidden="true"></span>' +
     11920                '</div>';
     11921
     11922            if ( isImage( filename ) ) {
     11923                preview = '<div class="forminator-uploaded-file--image" aria-hidden="true">' +
     11924                    '<div class="forminator-img-preview" role="image"></div>' +
     11925                    '</div>';
     11926            }
     11927
     11928            /**
     11929             * File Name.
     11930             *
     11931             * Get the name of the uploaded file (extension included).
     11932             */
     11933
     11934            var name = '<p class="forminator-uploaded-file--title">' + filename.replace( /[<>:"/\\|?*]+/g, '_' ) + '</p>';
     11935
     11936            /**
     11937             * File Size.
     11938             *
     11939             * Depending on the state of the file user will get a:
     11940             * - Loading Icon: When file is still being uploaded.
     11941             *   This will be accompanied by percent amount.
     11942             * - Warning Icon: When file finished loading but an
     11943             *   error happened.
     11944             * - File Size.
     11945             */
     11946
     11947            var size = '<p class="forminator-uploaded-file--size">' +
     11948                '<span class="forminator-icon-loader forminator-loading" aria-hidden="true"></span>' +
     11949                '<span class="progress-percentage">29% of </span>' +
     11950                filesize +
     11951                '</p>';
     11952
     11953            /**
     11954             * File Delete Button.
     11955             *
     11956             * This icon button will have the ability to remove
     11957             * the uploaded file.
     11958             */
     11959
     11960            var trash = '<button type="button" class="forminator-uploaded-file--delete forminator-button-delete" data-method="' + method + '" data-element="' + self.element + '" data-value="' + uniqueId + '">' +
     11961                '<span class="forminator-icon-close" aria-hidden="true"></span>' +
     11962                '<span class="forminator-screen-reader-only">Delete uploaded file</span>' +
     11963                '</button>';
     11964
     11965            /**
     11966             * Markup.
     11967             */
     11968
     11969            markup += '<li id="' + uniqueId + '" class="forminator-uploaded-file">';
     11970            markup += '<div class="forminator-uploaded-file--content">';
     11971            markup += preview;
     11972            markup += '<div class="forminator-uploaded-file--text">';
     11973            markup += name;
     11974            markup += size;
     11975            markup += '</div>';
     11976            markup += trash;
     11977            markup += '</div>';
     11978            markup += '</li>';
     11979
     11980            /**
     11981             * Has Files Class.
     11982             *
     11983             * Add "forminator-has-files" class to wrapper.
     11984             */
     11985
     11986            if ( ! wrapper.hasClass( '.forminator-has-files' ) ) {
     11987                wrapper.addClass( 'forminator-has-files' );
     11988            }
     11989
     11990            return wrapper.append( markup ), uniqueId;
     11991
     11992        },
     11993
     11994        bytes_to_size: function ( bytes, decimals ) {
     11995
     11996            if ( 0 === bytes ) return '0 Bytes';
     11997
     11998            var k = 1024,
     11999                dm = decimals < 0 ? 0 : decimals,
     12000                sizes = [ 'Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ],
     12001                i = Math.floor( Math.log( bytes ) / Math.log( k ) );
     12002
     12003            return parseFloat( ( bytes / Math.pow( k, i ) ).toFixed( dm ) ) + ' ' + sizes[ i ];
     12004        },
     12005
     12006        /**
     12007         * image preview
     12008         *
     12009         * @param image
     12010         * @param uniqueId
     12011         */
     12012        progress_image_preview: function ( image, uniqueId ) {
     12013            if ( image ) {
     12014                var reader = new FileReader();
     12015                reader.onload = function (e) {
     12016                    $('#'+ uniqueId + ' .forminator-img-preview').css('background-image', 'url(' + e.target.result + ')');
     12017                };
     12018                reader.readAsDataURL(image);
     12019            }
     12020        },
     12021
     12022        /**
     12023         * Get all uploaded file
     12024         *
     12025         * @returns {*}
     12026         */
     12027        get_uplaoded_files: function () {
     12028            var uploaded_value = this.form.find( '.forminator-multifile-hidden' ), files;
     12029
     12030            files = uploaded_value.val();
     12031            files = ( typeof files === "undefined" ) || files === '' ? {} : $.parseJSON( files );
     12032
     12033            return files;
     12034        },
     12035
     12036        /**
     12037         * Get file by element
     12038         *
     12039         * @param element
     12040         * @returns {*}
     12041         */
     12042        get_uplaoded_file: function ( element ) {
     12043            var uploaded_file = this.get_uplaoded_files();
     12044
     12045            if( typeof uploaded_file[ element ] === 'undefined' )
     12046                uploaded_file[ element ] = [];
     12047
     12048            return uploaded_file[ element ];
     12049        },
     12050
     12051        /**
     12052         * Add uploaded file
     12053         *
     12054         * @param element
     12055         * @param response
     12056         */
     12057        add_upload_file: function ( element, response ) {
     12058            var files = this.get_uplaoded_file( element );
     12059
     12060            files.unshift( response );
     12061            this.set_upload_file( element, files );
     12062        },
     12063
     12064        /**
     12065         * Set upload file
     12066         *
     12067         * @param element
     12068         * @param files
     12069         */
     12070        set_upload_file: function ( element, files ) {
     12071            var upload_file = this.get_uplaoded_files(),
     12072                uploaded_value = this.form.find( '.forminator-multifile-hidden' );
     12073            upload_file[ element ] = files;
     12074            uploaded_value.val( JSON.stringify( upload_file ) );
     12075        },
     12076
     12077        /**
     12078         * Get uploaded by file id
     12079         *
     12080         * @param element
     12081         * @param file_id
     12082         * @returns {*}
     12083         */
     12084        get_uploaded_file_id: function ( element, file_id ) {
     12085            var file_index = null,
     12086                upload_file = this.get_uplaoded_file( element );
     12087            $.each( upload_file, function ( key, val ) {
     12088                if( file_id === val['file_id'] ) file_index = key;
     12089            });
     12090
     12091            return file_index;
     12092        },
     12093
     12094        /**
     12095         * Delete files
     12096         */
     12097        delete_files: function ( fileList, ajax_request ) {
     12098            var self = this;
     12099            $( document ).on( "click", ".forminator-uploaded-file--delete", function( e ) {
     12100                e.preventDefault();
     12101                var deleteButton = $( this ),
     12102                    file_id = deleteButton.data('value'),
     12103                    method = deleteButton.data('method'),
     12104                    element_id = deleteButton.data('element');
     12105                if( 'undefined' !== typeof file_id && 'undefined' !== typeof element_id && 'undefined' !== typeof method ) {
     12106
     12107                    var index = self.form.find('#' + file_id ).index(),
     12108                        fileContainer = $( deleteButton ).closest( 'li#' + file_id ),
     12109                        uploaded_arr = self.get_uplaoded_files(),
     12110                        uploaded_value = self.form.find( '.forminator-multifile-hidden' );
     12111
     12112                    if ( uploaded_arr && 'ajax' === method ) {
     12113
     12114                        if( 'undefined' !== typeof ajax_request[ index ] ) {
     12115                            ajax_request[ index ].abort();
     12116                            ajax_request.splice( index, 1 );
     12117                        }
     12118                        if( 'undefined' !== typeof uploaded_value ) {
     12119                            var file_index = self.get_uploaded_file_id( element_id, file_id );
     12120                            if( '' !== file_index && null !== file_index ) {
     12121                                uploaded_arr[ element_id ].splice( file_index, 1 );
     12122                            }
     12123                            uploaded_value.val( JSON.stringify( uploaded_arr ) );
     12124                        }
     12125                    }
     12126
     12127                    if( 'undefined' !== typeof method && 'submission' === method ) {
     12128                        self.remove_object( index, fileList, element_id );
     12129                    }
     12130
     12131                    $( fileContainer ).remove();
     12132                }
     12133
     12134                var fileInput = self.form.find( '.forminator-field-'+ element_id + '-' + self.form_id );
     12135                var liList = self.form.find('.upload-container-' + element_id + ' li' );
     12136                if( 'undefined' !== typeof fileInput.data('limit') ) {
     12137                    $.each( liList,function( index ) {
     12138                        if( fileInput.data('limit') > index && $(this).hasClass('forminator-upload-limit_error') ) {
     12139                            var fileID = $(this).attr('id'),
     12140                                fileIndex = self.get_uploaded_file_id( element_id, fileID );
     12141                            $(this).removeClass('forminator-has_error');
     12142                            $(this).find('.forminator-error-message, .forminator-icon-warning, .progress-percentage').remove();
     12143                            if( '' !== fileIndex && null !== fileIndex && 'undefined' !== typeof uploaded_arr[ element_id ][ fileIndex ] ) {
     12144                                uploaded_arr[ element_id ][ fileIndex ].success = true;
     12145                            }
     12146                        }
     12147                    });
     12148                    uploaded_value.val( JSON.stringify( uploaded_arr ) );
     12149                }
     12150
     12151                // empty file input value if no files left
     12152                if ( liList.length === 0 ) {
     12153                    fileInput.val('');
     12154                }
     12155
     12156                // Re-enable submit button if there are no errors on the upload fields.
     12157                if ( 0 === self.form.find( '.forminator-uploaded-file.forminator-has_error' ).length ) {
     12158                    self.form.trigger( 'forminator:uploads:valid' );
     12159                    self.form.find('.forminator-button-submit').attr( 'disabled', false );
     12160                }
     12161            })
     12162        },
     12163
     12164        remove_object: function( index, fileList, element_id ) {
     12165            var upload_input = document.querySelector( '.forminator-field-'+ element_id + '-' + this.form_id );
     12166            if( 'undefined' !== typeof upload_input ) {
     12167                var upload_files = upload_input.files;
     12168                if( upload_files.length > 0 ) {
     12169                    var upload_slice = Array.prototype.slice.call( upload_files );
     12170                    fileList.splice( index, 1 );
     12171                    upload_slice.splice( index, 1 );
     12172                    upload_input.files = this.FileObjectItem( upload_slice );
     12173                }
     12174            }
     12175        },
     12176
     12177        /**
     12178         * File list object
     12179         *
     12180         * @param a
     12181         * @returns {FileList}
     12182         * @constructor
     12183         */
     12184        FileObjectItem: function ( a ) {
     12185            a = [].slice.call( Array.isArray( a ) ? a : arguments );
     12186            a = a.reverse();
     12187            for ( var c, b = c = a.length, d = !0; b-- && d; ) {
     12188                d = a[ b ] instanceof File;
     12189            }
     12190            if ( ! d ) throw new TypeError("expected argument to FileList is File or array of File objects");
     12191            for ( b = ( new ClipboardEvent("") ).clipboardData || new DataTransfer; c--;) {
     12192                b.items.add( a[ c ] );
     12193            }
     12194
     12195            return b.files
     12196        }
     12197    });
     12198
     12199    // A really lightweight plugin wrapper around the constructor,
     12200    // preventing against multiple instantiations
     12201    $.fn[pluginName] = function (options) {
     12202        return this.each(function () {
     12203            if (!$.data(this, pluginName)) {
     12204                $.data(this, pluginName, new ForminatorFrontMultiFile(this, options));
     12205            }
     12206        });
     12207    };
     12208
     12209})(jQuery, window, document);
  • forminator/trunk/constants.php

    r3028842 r3047085  
    1212
    1313if ( ! defined( 'FORMINATOR_VERSION' ) ) {
    14     define( 'FORMINATOR_VERSION', '1.29.0' );
     14    define( 'FORMINATOR_VERSION', '1.29.2' );
    1515}
    1616
  • forminator/trunk/forminator.php

    r3028842 r3047085  
    22/**
    33 * Plugin Name: Forminator
    4  * Version: 1.29.0
     4 * Version: 1.29.2
    55 * Plugin URI:  https://wpmudev.com/project/forminator/
    66 * Description: Capture user information (as detailed as you like), engage users with interactive polls that show real-time results and graphs, “no wrong answer” Facebook-style quizzes and knowledge tests.
  • forminator/trunk/languages/forminator.pot

    r3028842 r3047085  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Forminator 1.29.0\n"
    6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/build\n"
    7 "POT-Creation-Date: 2024-01-23 13:29:04+00:00\n"
     5"Project-Id-Version: Forminator 1.29.2\n"
     6"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/forminator\n"
     7"POT-Creation-Date: 2024-03-07 11:49:22+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=utf-8\n"
     
    658658#: addons/pro/campaignmonitor/class-forminator-addon-campaignmonitor.php:346
    659659#: addons/pro/googlesheet/class-forminator-addon-googlesheet.php:408
    660 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:321
     660#: addons/pro/hubspot/class-forminator-addon-hubspot.php:311
    661661#: addons/pro/mailchimp/class-forminator-addon-mailchimp.php:632
    662662#: addons/pro/mailjet/class-forminator-addon-mailjet.php:549
     
    735735#: addons/pro/campaignmonitor/lib/class-forminator-addon-campaignmonitor-wp-api.php:222
    736736#: addons/pro/campaignmonitor/lib/class-forminator-addon-campaignmonitor-wp-api.php:227
    737 #: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:246
    738 #: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:251
    739 #: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:267
    740 #: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:277
     737#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:247
     738#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:252
     739#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:268
     740#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:278
     741#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:470
    741742#: addons/pro/mailchimp/lib/class-forminator-addon-mailchimp-wp-api.php:248
    742743#: addons/pro/mailchimp/lib/class-forminator-addon-mailchimp-wp-api.php:253
     
    12361237
    12371238#: addons/pro/aweber/lib/class-forminator-addon-aweber-wp-api.php:230
    1238 #: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:231
     1239#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:232
     1240#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:468
    12391241#: addons/pro/slack/lib/class-forminator-addon-slack-wp-api.php:209
    12401242msgid ""
     
    18421844#: addons/pro/googlesheet/class-forminator-addon-googlesheet.php:240
    18431845#: addons/pro/googlesheet/class-forminator-addon-googlesheet.php:364
    1844 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:264
     1846#: addons/pro/hubspot/class-forminator-addon-hubspot.php:254
    18451847#: addons/pro/slack/class-forminator-addon-slack.php:394
    18461848#: addons/pro/trello/class-forminator-addon-trello.php:442
     
    18651867
    18661868#: addons/pro/googlesheet/class-forminator-addon-googlesheet.php:583
    1867 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:524
     1869#: addons/pro/hubspot/class-forminator-addon-hubspot.php:514
    18681870#: addons/pro/slack/class-forminator-addon-slack.php:684
    18691871msgid "Failed to get token"
     
    22512253msgstr ""
    22522254
    2253 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:113
     2255#: addons/pro/hubspot/class-forminator-addon-hubspot.php:103
    22542256msgid "HubSpot is not active"
    22552257msgstr ""
    22562258
     2259#: addons/pro/hubspot/class-forminator-addon-hubspot.php:143
     2260#: addons/pro/hubspot/class-forminator-addon-hubspot.php:631
     2261#: addons/pro/hubspot/class-forminator-addon-hubspot.php:681
     2262msgid "HubSpot is not connected"
     2263msgstr ""
     2264
     2265#: addons/pro/hubspot/class-forminator-addon-hubspot.php:148
     2266msgid "Invalid Form Settings of HubSpot"
     2267msgstr ""
     2268
    22572269#: addons/pro/hubspot/class-forminator-addon-hubspot.php:153
    2258 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:667
    2259 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:717
    2260 msgid "HubSpot is not connected"
    2261 msgstr ""
    2262 
    2263 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:158
    2264 msgid "Invalid Form Settings of HubSpot"
    2265 msgstr ""
    2266 
    2267 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:163
    22682270msgid "No active HubSpot connection found in this form"
    22692271msgstr ""
    22702272
    2271 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:547
     2273#: addons/pro/hubspot/class-forminator-addon-hubspot.php:537
    22722274#: addons/pro/slack/class-forminator-addon-slack.php:703
    22732275msgid "Failed to get authorization code."
    22742276msgstr ""
    22752277
    2276 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:635
     2278#: addons/pro/hubspot/class-forminator-addon-hubspot.php:599
    22772279msgid "Pipeline can not be empty."
    22782280msgstr ""
    22792281
    2280 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:672
    2281 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:722
     2282#: addons/pro/hubspot/class-forminator-addon-hubspot.php:636
     2283#: addons/pro/hubspot/class-forminator-addon-hubspot.php:686
    22822284msgid "Invalid Quiz Settings of HubSpot"
    22832285msgstr ""
    22842286
    2285 #: addons/pro/hubspot/class-forminator-addon-hubspot.php:677
     2287#: addons/pro/hubspot/class-forminator-addon-hubspot.php:641
    22862288msgid "No active HubSpot connection found in this quiz"
    22872289msgstr ""
    22882290
    2289 #: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:77
     2291#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:75
    22902292#: addons/pro/slack/lib/class-forminator-addon-slack-wp-api.php:75
    22912293#: addons/pro/trello/lib/class-forminator-addon-trello-wp-api.php:73
     
    22932295msgstr ""
    22942296
    2295 #: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:264
     2297#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:265
    22962298#: admin/locale.php:762
    22972299msgid "Invalid"
    22982300msgstr ""
    22992301
    2300 #: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:714
     2302#: addons/pro/hubspot/lib/class-forminator-addon-hubspot-wp-api.php:724
    23012303msgid "Property does not exist"
    23022304msgstr ""
     
    1868318685msgstr ""
    1868418686
    18685 #: library/fields/upload.php:158 library/fields/upload.php:473
     18687#: library/fields/upload.php:158 library/fields/upload.php:482
    1868618688#. translators: %d: File limit
    1868718689msgid "You can upload a maximum of %d files."
    1868818690msgstr ""
    1868918691
    18690 #: library/fields/upload.php:169 library/fields/upload.php:433
     18692#: library/fields/upload.php:169 library/fields/upload.php:442
    1869118693#. translators: %s: Maximum size
    1869218694msgid "Maximum file size allowed is %s. "
     
    1870618708msgstr ""
    1870718709
    18708 #: library/fields/upload.php:421
     18710#: library/fields/upload.php:410
     18711msgid "Sorry, you are not allowed to upload this file type."
     18712msgstr ""
     18713
     18714#: library/fields/upload.php:430
    1870918715msgid "The attached file is empty and can't be uploaded."
    1871018716msgstr ""
    1871118717
    18712 #: library/fields/upload.php:442 library/fields/upload.php:509
    18713 #: library/fields/upload.php:618 library/fields/upload.php:669
    18714 #: library/fields/upload.php:743
     18718#: library/fields/upload.php:451 library/fields/upload.php:518
     18719#: library/fields/upload.php:640 library/fields/upload.php:691
     18720#: library/fields/upload.php:765
    1871518721msgid "Error saving form. Upload error."
    1871618722msgstr ""
  • forminator/trunk/library/class-core.php

    r3028842 r3047085  
    431431        } else {
    432432            $value = $default_value;
     433        }
     434        if ( 'page' === $key ) {
     435            $value = esc_attr( $value );
    433436        }
    434437
  • forminator/trunk/library/fields/upload.php

    r3028842 r3047085  
    403403                }
    404404
     405                $valid_mime = self::check_mime_type( $file_object['tmp_name'], $file_object['name'] );
     406
     407                if ( ! $valid_mime ) {
     408                    return array(
     409                        'success' => false,
     410                        'message' => esc_html__( 'Sorry, you are not allowed to upload this file type.', 'forminator' ),
     411                    );
     412                }
     413
    405414                $upload_dir       = wp_upload_dir(); // Set upload folder.
    406415                $file_path        = 'upload' === $upload_type ? forminator_upload_root_temp() : forminator_get_upload_path( $form_id, 'uploads' );
     
    514523
    515524        return false;
     525    }
     526
     527    /**
     528     * Check if content mime type is relevant to passed mime type
     529     *
     530     * @param string $file Full path to the file.
     531     * @param string $file_name The name of the file.
     532     * @return bool
     533     */
     534    private static function check_mime_type( string $file, string $file_name ) : bool {
     535        $wp_filetype = wp_check_filetype_and_ext( $file, $file_name );
     536
     537        return ! empty( $wp_filetype['ext'] ) && ! empty( $wp_filetype['type'] );
    516538    }
    517539
  • forminator/trunk/readme.txt

    r3028842 r3047085  
    88Requires at least: 5.2
    99Tested up to: 6.4
    10 Stable tag: 1.29.0
     10Stable tag: 1.29.2
    1111Requires PHP: 7.4
    1212License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     
    223223
    224224== Changelog ==
     225
     226= 1.29.2 ( 2024-03-07 ) =
     227
     228- Fix: Stripe doesn't work on some mobile devices
     229
     230
     231= 1.29.1 ( 2024-03-05 ) =
     232
     233- Fix: XSS vulnerabilities
     234
    225235
    226236= 1.29.0 ( 2024-01-30 ) =
  • forminator/trunk/requirejs/admin/layout.js

    r3028842 r3047085  
    1 function copyToClipboard(e){var t=jQuery("<input />");jQuery("body").append(t),t.val(e).select(),document.execCommand("copy"),t.remove()}function copyToClipboardModal(e){e.trigger("select"),document.execCommand("copy")}!function(e,t){"use strict";!function(){e(function(){if("object"==typeof window.Forminator&&"object"==typeof window.Forminator.Utils&&Forminator.Utils.sui_delegate_events(),e(".forminator-toggle-entries-filter").on("click",function(t){return e(this).toggleClass("sui-active"),e(this).closest(".sui-box-body").find(".sui-pagination-filter").toggleClass("sui-open"),!1}),void 0!==e.fn.daterangepicker){var t={},i=e("input.forminator-entries-filter-date");void 0!==window.forminator_entries_datepicker_ranges&&(t=window.forminator_entries_datepicker_ranges);var n={autoUpdateInput:!1,autoApply:!0,alwaysShowCalendars:!0,ranges:t,locale:forminatorl10n.daterangepicker};i.daterangepicker(n),i.on("apply.daterangepicker",function(t,i){e(this).val(i.startDate.format("YYYY-MM-DD")+" - "+i.endDate.format("YYYY-MM-DD"))})}if(e("form.forminator-entries-actions").on("submit",function(){return""===e(this).find("select[name=entries-action]").val()&&""===e(this).find("select[name=entries-action-bottom]").val()?e(this).find("fieldset.forminator-entries-nonce").attr("disabled","disabled"):e(this).find("fieldset.forminator-entries-nonce").removeAttr("disabled"),!0}),e(".forminator-entries-clear-filter").on("click",function(){return e(this).closest(".sui-pagination-filter").find("input[name=date_range]").val("").trigger("change"),e(this).closest(".sui-pagination-filter").find("input[name=search]").val("").trigger("change"),e(this).closest(".sui-pagination-filter").find("input[name=min_id]").val("").trigger("change"),e(this).closest(".sui-pagination-filter").find("input[name=max_id]").val("").trigger("change"),e(this).closest(".sui-pagination-filter").find("select[name=order_by] option").removeAttr("selected"),e(this).closest(".sui-pagination-filter").find("select[name=order_by]").val("").trigger("change"),e(this).closest(".sui-pagination-filter").find("select[name=order_by] option").removeAttr("selected"),e(this).closest(".sui-pagination-filter").find("select[name=order_by]").val("").trigger("change"),e(this).closest(".sui-pagination-filter").find("select[name=order] option").removeAttr("selected"),e(this).closest(".sui-pagination-filter").find("select[name=order]").val("").trigger("change"),e(this).closest(".sui-pagination-filter").find(".forminator-field-select-tab .sui-tabs-menu label[data-tab-index=1]").trigger("click"),e(this).closest(".sui-pagination-filter").find("fieldset.forminator-entries-fields-filter").attr("disabled","disabled"),!1}),e(".forminator-field-select-tab .sui-tabs-menu label").on("click",function(){var t=e(this).data("tab-index");t=+t,e(this).closest(".sui-side-tabs").find(".sui-tabs-menu label").removeClass("active"),e(this).addClass("active"),e(this).closest(".sui-side-tabs").find(".sui-tabs-content .sui-tab-content").removeClass("active"),e(this).closest(".sui-side-tabs").find(".sui-tabs-content .sui-tab-content[data-tab-index="+t+"]").addClass("active"),1===t?e(this).closest(".sui-side-tabs").find("fieldset.forminator-entries-fields-filter").attr("disabled","disabled"):e(this).closest(".sui-side-tabs").find("fieldset.forminator-entries-fields-filter").removeAttr("disabled")}),e("#wpf-cform-check_all").on("click",function(t){var i=this.checked,n=e(this).closest("table");e(n).find(".sui-checkbox input").each(function(){this.checked=i})}),e(document).on("click",".resend-activation-btn",function(t){t.preventDefault();const i=e(t.currentTarget);i.prop("disabled",!0),e.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_resend_activation_link",key:i.data("activation-key"),_ajax_nonce:i.data("nonce")},success:function(e){var t="success";e.success||(t="error"),Forminator.Notification.open(t,e.data,4e3)}}).always(function(){i.prop("disabled",!1)})}),e(document).on("click",".forminator-resend-notification-email",function(t){t.preventDefault();const i=e(t.currentTarget);i.prop("disabled",!0),e.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_resend_notification_email",entry_id:i.data("entry-id"),_ajax_nonce:i.data("nonce")},success:function(e){var t="success";e.success||(t="error"),Forminator.Notification.open(t,e.data,4e3)}}).always(function(){i.prop("disabled",!1)})}),e("#forminator-check-all-modules").on("click",function(){var t=this.checked;if(e("#forminator-modules-list").length&&(e("#forminator-modules-list").find('.sui-checkbox input[id|="wpf-module"]').each(function(){this.checked=t}),e('form[name="bulk-action-form"] input[name="ids"]').length)){var i=e("#forminator-modules-list").find('.sui-checkbox input[id|="wpf-module"]:checked').map(function(){if(parseFloat(this.value))return this.value}).get().join(",");e('form[name="bulk-action-form"] input[name="ids"]').val(i)}}),0!==e('form[name="bulk-action-form"]').length&&e(document).on("click",".sui-checkbox input",function(){if(e('form[name="bulk-action-form"] input[name="ids"]').length){var t=e(".sui-checkbox input:checked").map(function(){if(parseFloat(this.value))return this.value}).get().join(",");e('form[name="bulk-action-form"] input[name="ids"]').val(t)}"forminator-check-all-modules"!==e(this).attr("id")&&e("#forminator-check-all-modules").prop("checked",!1)}),e(function(){e(".wpmudev-can--hide").find(".wpmudev-box-header").on("click",function(){e(this).closest(".wpmudev-can--hide").toggleClass("wpmudev-is--hidden")})}),e(document).on("click",".wpmudev-open-entry",function(t){if("checkbox"!==e(t.target).attr("type")&&!e(t.target).hasClass("wpdui-icon-check")){t.preventDefault(),t.stopPropagation();var i=e(this),n=i.data("entry"),a=e("#forminator-"+n),o=!0;a.hasClass("wpmudev-is_open")&&(o=!1),e(".wpmudev-entries--result").removeClass("wpmudev-is_open"),o&&a.toggleClass("wpmudev-is_open")}}),e(function(){e(".wpmudev-result--menu").find(".wpmudev-button-action").on("click",function(){var t=e(this).next(".wpmudev-menu");e(".wpmudev-result--menu.wpmudev-active").removeClass("wpmudev-active"),e(".wpmudev-button-action.wpmudev-active").not(e(this)).removeClass("wpmudev-active"),e(".wpmudev-menu").not(t).addClass("wpmudev-hidden"),e(this).toggleClass("wpmudev-active"),t.toggleClass("wpmudev-hidden")})}),e(function(){var t=e(".wpmudev-list"),i=t.find(".wpmudev-list-table"),n=i.find(".wpmudev-table-body tr"),a=n.length,o=a;n.each(function(){e(this).find(".wpmudev-body-menu").css("z-index",o),o--})}),e(function(){e("body").on("change",".sui-insert-variables select",function(t){var i=e(t.target),n=i.data("textarea-id");if(n){if(t.preventDefault(),e("#"+n).length>0){var a=e("input#"+n+",textarea#"+n),o=a.val();a.val(o+" "+i.val()),a.trigger("change",a.val())}return!1}}),e(document).on("click",".copy-clipboard",function(t){t.preventDefault(),copyToClipboard(e(this).data("shortcode")),Forminator.Notification.open("success",Forminator.l10n.options.shortcode_copied,4e3)}),e("body").on("click",".delete-poll-submission",function(t){var i=e(t.target),n={action:"forminator_delete_poll_submissions",id:i.data("id"),_ajax_nonce:i.data("nonce")};i.addClass("sui-button-onload"),e.post({url:Forminator.Data.ajaxUrl,type:"post",data:n}).done(function(e){e.success&&jQuery(".sui-poll-submission").addClass("sui-message").html("").html(e.data.html),Forminator.Popup.close(),_.isUndefined(e.data.notification)||_.isUndefined(e.data.notification.type)||_.isUndefined(e.data.notification.text)||_.isUndefined(e.data.notification.duration)||Forminator.Notification.open(e.data.notification.type,e.data.notification.text,e.data.notification.duration).done(function(){})})}),e(".forminator-grouped-notice .notice-dismiss").on("click",function(t){t.preventDefault();const i=e(t.currentTarget).closest(".forminator-grouped-notice");jQuery.post(ajaxurl,{action:"forminator_dismiss_notice",slug:i.data("notice-slug"),_ajax_nonce:i.data("nonce")}).always(function(){i.hide()})})}),0!==e("#forminator-search-modules").length){var a=e("#forminator-search-modules"),o=a.find('input[name="page"]').val(),r=forminatorData.adminUrl+"admin.php?page="+o,s=a.find('input[name="search"]'),c=s.val(),d=e("#forminator-modules-list"),l=e("#search_loader");a.on("submit",function(t){if(t.preventDefault(),s=e(this).find('input[name="search"]'),c=s.val(),0===c.length)return void("true"===e(this).data("searched")&&(window.location.href=r));e(this).data("searched","true"),e.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_module_search",_ajax_nonce:e(this).find("#forminator-nonce-search-module").val(),search_keyword:c,modules:e(this).find('input[name="modules"]').val(),module_slug:e(this).find('input[name="module_slug"]').val(),preview_title:e(this).find('input[name="preview_title"]').val(),sql_month_start_date:e(this).find('input[name="sql_month_start_date"]').val(),wizard_page:e(this).find('input[name="wizard_page"]').val(),preview_dialog:e(this).find('input[name="preview_dialog"]').val(),export_dialog:e(this).find('input[name="export_dialog"]').val(),post_type:e(this).find('input[name="post_type"]').val(),page:o},beforeSend:function(){d.empty(),l.show(),s.prop("disabled",!0),e(".sui-pagination").remove(),e(".sui-pagination-results").html(""),e("#forminator-search-modules .search-reset").hide()},success:function(t){l.hide(),d.html(t.data),e("html").animate({scrollTop:d.offset().top-150},300),e('form[name="bulk-action-form"]').find('input[name="msearch"]').val(c),d.find('.module-actions input[name="msearch"]').val(c),s.prop("disabled",!1),e(".sui-pagination-results").html(window.singularPluralText(d.find(".sui-accordion-item").length,Forminator.l10n.form.result,Forminator.l10n.form.results)),e("#forminator-search-modules .search-reset").show()}})}),0!==s.length&&0!==c.length&&a.submit(),e(document).on("click","#forminator-search-modules .search-reset",function(e){e.preventDefault(),window.location.href=r})}e(document).on("click",".sui-box-search .sui-button",function(t){"apply-preset-forms"===e('select[name="forminator_action"]').val()&&(t.preventDefault(),e("#forminator_bulk_apply_preset").trigger("click"))})}),e(window).on("load",function(){"object"==typeof window.Forminator&&"object"==typeof window.Forminator.Utils&&"forminator-entries"===Forminator.Utils.get_url_param("page")&&!1===Forminator.Utils.get_url_param("form_type")&&!1===Forminator.Utils.get_url_param("form_id")&&e(".show-submissions").trigger("click")}),e(window).on("pageshow",function(e){(e.persisted||void 0!==window.performance&&"back_forward"===window.performance.getEntriesByType("navigation")[0].type)&&window.location.reload()})}()}(jQuery,document);var forminator_render_captcha=function(){jQuery(".forminator-g-recaptcha").each(function(){var e=jQuery(this).data("size"),t={sitekey:jQuery(this).data("sitekey"),theme:jQuery(this).data("theme"),badge:jQuery(this).data("badge"),size:e};if(""!==t.sitekey){window.grecaptcha.render(jQuery(this)[0],t)}})};
     1(function( $, doc ) {
     2    "use strict";
     3
     4    (function () {
     5
     6        $( function () {
     7            if (typeof window.Forminator === 'object' && typeof window.Forminator.Utils === 'object') {
     8                Forminator.Utils.sui_delegate_events();
     9            }
     10
     11            /**
     12             * ======START Entries Page=====
     13             */
     14            // filter entries toggle
     15            $('.forminator-toggle-entries-filter').on("click", function (e) {
     16                $(this).toggleClass('sui-active');
     17                $(this).closest('.sui-box-body').find('.sui-pagination-filter').toggleClass('sui-open');
     18                return false
     19            });
     20
     21
     22            //Datepicker
     23            if ( typeof $.fn.daterangepicker !== 'undefined' ) {
     24                var date_picker_range = {},
     25                    date_picker_input = $('input.forminator-entries-filter-date'),
     26                    date_picker_format = 'YYYY-MM-DD';
     27                if (typeof window.forminator_entries_datepicker_ranges !== 'undefined') {
     28                    date_picker_range = window.forminator_entries_datepicker_ranges;
     29                }
     30                var date_args = {
     31                    autoUpdateInput: false,
     32                    autoApply: true,
     33                    alwaysShowCalendars: true,
     34                    ranges: date_picker_range,
     35                    locale: forminatorl10n.daterangepicker
     36                };
     37                date_picker_input.daterangepicker( date_args );
     38                date_picker_input.on('apply.daterangepicker', function (ev, picker) {
     39                    var $this = $( this );
     40                    $this.val( picker.startDate.format( date_picker_format ) + ' - ' + picker.endDate.format( date_picker_format ) );
     41                });
     42            }
     43
     44            // before filter submit
     45            // remove nonce and http referer
     46            $('form.forminator-entries-actions').on('submit', function () {
     47                if ($(this).find('select[name=entries-action]').val() === '' && $(this).find('select[name=entries-action-bottom]').val() === '') {
     48                    $(this).find('fieldset.forminator-entries-nonce').attr('disabled', 'disabled');
     49                } else {
     50                    $(this).find('fieldset.forminator-entries-nonce').removeAttr('disabled')
     51                }
     52                return true;
     53            });
     54
     55            // on clear filters
     56            $('.forminator-entries-clear-filter').on("click", function () {
     57                $(this).closest('.sui-pagination-filter').find('input[name=date_range]').val('').trigger('change');
     58                $(this).closest('.sui-pagination-filter').find('input[name=search]').val('').trigger('change');
     59                $(this).closest('.sui-pagination-filter').find('input[name=min_id]').val('').trigger('change');
     60                $(this).closest('.sui-pagination-filter').find('input[name=max_id]').val('').trigger('change');
     61
     62                $(this).closest('.sui-pagination-filter').find('select[name=order_by] option').removeAttr('selected');
     63                $(this).closest('.sui-pagination-filter').find('select[name=order_by]').val('').trigger('change');
     64
     65                $(this).closest('.sui-pagination-filter').find('select[name=order_by] option').removeAttr('selected');
     66                $(this).closest('.sui-pagination-filter').find('select[name=order_by]').val('').trigger('change');
     67
     68                $(this).closest('.sui-pagination-filter').find('select[name=order] option').removeAttr('selected');
     69                $(this).closest('.sui-pagination-filter').find('select[name=order]').val('').trigger('change');
     70
     71                $(this).closest('.sui-pagination-filter').find('.forminator-field-select-tab .sui-tabs-menu label[data-tab-index=1]').trigger('click');
     72
     73                $(this).closest('.sui-pagination-filter').find('fieldset.forminator-entries-fields-filter').attr('disabled', 'disabled');
     74
     75                return false;
     76
     77            });
     78
     79            // Display fields tabs
     80            $('.forminator-field-select-tab .sui-tabs-menu label').on("click", function () {
     81                var tab_index = $(this).data('tab-index');
     82                tab_index     = +tab_index;
     83
     84                $(this).closest('.sui-side-tabs').find('.sui-tabs-menu label').removeClass('active');
     85                $(this).addClass('active');
     86
     87                $(this).closest('.sui-side-tabs').find('.sui-tabs-content .sui-tab-content').removeClass('active');
     88                $(this).closest('.sui-side-tabs').find('.sui-tabs-content .sui-tab-content[data-tab-index=' + tab_index + ']').addClass('active');
     89
     90
     91                if (tab_index === 1) {
     92                    $(this).closest('.sui-side-tabs').find('fieldset.forminator-entries-fields-filter').attr('disabled', 'disabled');
     93                } else {
     94                    $(this).closest('.sui-side-tabs').find('fieldset.forminator-entries-fields-filter').removeAttr('disabled');
     95                }
     96
     97            });
     98
     99            $( "#wpf-cform-check_all" ).on( "click", function ( e ) {
     100                var checked = this.checked;
     101                var table = $(this).closest('table');
     102                $(table).find( ".sui-checkbox input" ).each( function () {
     103                    this.checked = checked;
     104                });
     105            });
     106
     107            // Resend Activation link
     108            $( document ).on( 'click', '.resend-activation-btn', function(e){
     109                e.preventDefault();
     110                const $btn = $( e.currentTarget );
     111                $btn.prop( 'disabled', true );
     112
     113                $.ajax({
     114                    url: Forminator.Data.ajaxUrl,
     115                    type: "POST",
     116                    data: {
     117                        action: 'forminator_resend_activation_link',
     118                        key: $btn.data( 'activation-key' ),
     119                        _ajax_nonce: $btn.data( 'nonce' )
     120                    },
     121                    success: function( result ){
     122                        var status = 'success';
     123
     124                        if ( ! result.success ) {
     125                            status = 'error';
     126                        }
     127
     128                        Forminator.Notification.open( status, result.data, 4000 );
     129                    }
     130                }).always(function () {
     131                    $btn.prop( 'disabled', false );
     132                });
     133            });
     134
     135            // Resend Notification Email.
     136            $( document ).on( 'click', '.forminator-resend-notification-email', function(e){
     137                e.preventDefault();
     138                const $btn = $( e.currentTarget );
     139                $btn.prop( 'disabled', true );
     140
     141                $.ajax({
     142                    url: Forminator.Data.ajaxUrl,
     143                    type: "POST",
     144                    data: {
     145                        action: 'forminator_resend_notification_email',
     146                        entry_id: $btn.data( 'entry-id' ),
     147                        _ajax_nonce: $btn.data( 'nonce' )
     148                    },
     149                    success: function( result ){
     150                        var status = 'success';
     151
     152                        if ( ! result.success ) {
     153                            status = 'error';
     154                        }
     155
     156                        Forminator.Notification.open( status, result.data, 4000 );
     157                    }
     158                }).always(function () {
     159                    $btn.prop( 'disabled', false );
     160                });
     161            });
     162
     163            /** ====== END Entries Page===== **/
     164
     165
     166            //cform,poll and quiz all check
     167            $('#forminator-check-all-modules').on("click", function () {
     168                var checked = this.checked;
     169                if ($('#forminator-modules-list').length) {
     170                    //Selects elements that have the specified attribute with a value
     171                    // either equal to a given string or starting with that string followed by a hyphen (-).
     172                    $('#forminator-modules-list').find('.sui-checkbox input[id|="wpf-module"]').each(function () {
     173                        this.checked = checked;
     174                    });
     175
     176                    if ($('form[name="bulk-action-form"] input[name="ids"]').length) {
     177                        var ids = $('#forminator-modules-list').find('.sui-checkbox input[id|="wpf-module"]:checked').map(function () {
     178                                if (parseFloat(this.value)) return this.value;
     179                            }
     180                        ).get().join(',');
     181                        $('form[name="bulk-action-form"] input[name="ids"]').val(ids);
     182                    }
     183                }
     184            });
     185
     186            //cform,poll and quiz single check
     187            if ( 0 !== $( 'form[name="bulk-action-form"]' ).length ) {
     188                $( document ).on( "click", ".sui-checkbox input", function(){
     189                    if ( $( 'form[name="bulk-action-form"] input[name="ids"]' ).length ) {
     190                        var ids = $( ".sui-checkbox input:checked" ).map( function() { if ( parseFloat( this.value ) ) return this.value; } ).get().join( ',' );
     191                            $( 'form[name="bulk-action-form"] input[name="ids"]' ).val( ids );
     192                    }
     193                    if( $(this).attr('id') !== 'forminator-check-all-modules') {
     194                        $('#forminator-check-all-modules').prop("checked", false);
     195                    }
     196                });
     197            }
     198
     199            // ACTION minimize
     200            $( function () {
     201                var $this = $( ".wpmudev-can--hide" ),
     202                    $button = $this.find( ".wpmudev-box-header" )
     203                ;
     204
     205                $button.on( "click", function () {
     206                    var $parent = $( this ).closest( ".wpmudev-can--hide" );
     207                    $parent.toggleClass( "wpmudev-is--hidden" );
     208                });
     209            });
     210
     211            // ACTION open entries
     212            $(document).on('click', '.wpmudev-open-entry', function(e){
     213
     214                if ($(e.target).attr('type') === 'checkbox' || $(e.target).hasClass('wpdui-icon-check') ) {
     215                    return;
     216                }
     217                e.preventDefault();
     218                e.stopPropagation();
     219
     220                var $this = $(this),
     221                    $entry_id = $this.data('entry'),
     222                    $entry = $("#forminator-" + $entry_id),
     223                    $open = true;
     224
     225                if ( $entry.hasClass( 'wpmudev-is_open' ) ) {
     226                    $open = false;
     227                }
     228                $('.wpmudev-entries--result').removeClass('wpmudev-is_open');
     229                if ( $open ) {
     230                    $entry.toggleClass('wpmudev-is_open');
     231                }
     232            });
     233
     234            // OPEN control menu
     235            $( function () {
     236                var $this = $( ".wpmudev-result--menu" ),
     237                    $button = $this.find( ".wpmudev-button-action" );
     238
     239                $button.on( "click", function () {
     240                    var $menu = $( this ).next( ".wpmudev-menu" );
     241
     242                    // Close all already opened menus
     243                    $( ".wpmudev-result--menu.wpmudev-active" ).removeClass( "wpmudev-active" );
     244                    $( ".wpmudev-button-action.wpmudev-active" ).not( $( this ) ).removeClass( "wpmudev-active" );
     245                    $( ".wpmudev-menu" ).not( $menu ).addClass( "wpmudev-hidden" );
     246
     247                    $( this ).toggleClass( "wpmudev-active" );
     248                    $menu.toggleClass( "wpmudev-hidden" );
     249                });
     250
     251            });
     252
     253            // ITEMS position
     254            $( function () {
     255
     256                var $this   = $( ".wpmudev-list" ),
     257                    $table  = $this.find( ".wpmudev-list-table" ),
     258                    $item   = $table.find( ".wpmudev-table-body tr" )
     259                ;
     260
     261                var $totalItems = $item.length,
     262                    $itemCount  = $totalItems
     263                ;
     264
     265                $item.each(function(){
     266                    $( this ).find( '.wpmudev-body-menu' ).css( 'z-index', $itemCount );
     267                    $itemCount--;
     268                });
     269
     270            });
     271
     272            // insert text
     273            $( function () {
     274                $('body').on('change', '.sui-insert-variables select', function (e) {
     275                    var $this = $(e.target);
     276
     277                    var textarea_id = $this.data('textarea-id');
     278                    if (textarea_id) {
     279                        e.preventDefault();
     280                        if ($('#' + textarea_id).length > 0) {
     281                            var textarea     = $('input#' + textarea_id + ',textarea#' + textarea_id);
     282                            var textarea_val = textarea.val();
     283                            textarea.val(textarea_val + ' ' + $this.val());
     284                            textarea.trigger('change', textarea.val());
     285                        }
     286                        return false;
     287                    }
     288
     289                });
     290
     291                $( document ).on( "click", '.copy-clipboard', function ( e ) {
     292                    e.preventDefault();
     293
     294                    copyToClipboard( $( this ).data( 'shortcode' ) );
     295
     296                    Forminator.Notification.open( 'success', Forminator.l10n.options.shortcode_copied, 4000 );
     297                });
     298
     299
     300                $('body').on('click', '.delete-poll-submission', function (e) {
     301                    var $target = $(e.target);
     302                    var new_request = {
     303                        action: 'forminator_delete_poll_submissions',
     304                        id: $target.data('id'),
     305                        _ajax_nonce: $target.data('nonce'),
     306                    };
     307                    $target.addClass('sui-button-onload');
     308
     309                    $.post({
     310                        url: Forminator.Data.ajaxUrl,
     311                        type: 'post',
     312                        data: new_request
     313                    })
     314                        .done(function (result) {
     315                            // Update screen
     316                            if( result.success ) {
     317                                jQuery('.sui-poll-submission').addClass('sui-message').html('').html(result.data.html);
     318                            }
     319
     320                            Forminator.Popup.close();
     321
     322                            // Handle notifications
     323                            if (!_.isUndefined(result.data.notification) &&
     324                                !_.isUndefined(result.data.notification.type) &&
     325                                !_.isUndefined(result.data.notification.text) &&
     326                                !_.isUndefined(result.data.notification.duration)
     327                            ) {
     328
     329                                Forminator.Notification.open(
     330                                    result.data.notification.type,
     331                                    result.data.notification.text,
     332                                    result.data.notification.duration
     333                                )
     334                                    .done(function () {});
     335
     336                            }
     337                        });
     338
     339                });
     340
     341                // Dismiss admin notice.
     342                $('.forminator-grouped-notice .notice-dismiss').on('click', function(e){
     343                    e.preventDefault();
     344                    const $notice = $(e.currentTarget).closest('.forminator-grouped-notice');
     345
     346                    jQuery.post(
     347                        ajaxurl,
     348                        {
     349                            action: 'forminator_dismiss_notice',
     350                            slug: $notice.data('notice-slug'),
     351                            _ajax_nonce: $notice.data('nonce')
     352                        }
     353                    ).always(function () {
     354                        $notice.hide();
     355                    });
     356                });
     357            });
     358
     359            /*
     360             * Ajax module Search
     361             */
     362            if ( 0 !== $( '#forminator-search-modules' ).length ) {
     363
     364                var $searchForm   = $( '#forminator-search-modules' );
     365                var $pageParam    = $searchForm.find( 'input[name="page"]' ).val();
     366                var $resetUrl     = forminatorData.adminUrl + 'admin.php?page=' + $pageParam;
     367                var $searchInput  = $searchForm.find( 'input[name="search"]' );
     368                var $searchKey    = $searchInput.val();
     369                var $modulesList  = $( '#forminator-modules-list' );
     370                var $searchLoader = $( '#search_loader' );
     371
     372                $searchForm.on( 'submit', function ( e ) {
     373                    e.preventDefault();
     374
     375                    // Redefine here to get the right value
     376                    $searchInput = $( this ).find( 'input[name="search"]' );
     377                    $searchKey   = $searchInput.val();
     378
     379                    // if submitted without search key, reload to original state
     380                    if ( 0 === $searchKey.length ) {
     381
     382                        if ( 'true' === $( this ).data( 'searched' ) ) {
     383                            window.location.href = $resetUrl;
     384                        }
     385
     386                        return;
     387                    }
     388
     389                    // Set searched data to true to check if page needs to be reloaded if search key is empty
     390                    $( this ).data( 'searched', 'true' );
     391
     392                    $.ajax({
     393                        url: Forminator.Data.ajaxUrl,
     394                        type: "POST",
     395                        data: {
     396                            action              : "forminator_module_search",
     397                            _ajax_nonce         : $( this ).find( '#forminator-nonce-search-module' ).val(),
     398                            search_keyword      : $searchKey,
     399                            modules             : $( this ).find( 'input[name="modules"]' ).val(),
     400                            module_slug         : $( this ).find( 'input[name="module_slug"]' ).val(),
     401                            preview_title       : $( this ).find( 'input[name="preview_title"]' ).val(),
     402                            sql_month_start_date: $( this ).find( 'input[name="sql_month_start_date"]' ).val(),
     403                            wizard_page         : $( this ).find( 'input[name="wizard_page"]' ).val(),
     404                            preview_dialog      : $( this ).find( 'input[name="preview_dialog"]' ).val(),
     405                            export_dialog       : $( this ).find( 'input[name="export_dialog"]' ).val(),
     406                            post_type           : $( this ).find( 'input[name="post_type"]' ).val(),
     407                            page                : $pageParam
     408                        },
     409                        beforeSend: function () {
     410                            $modulesList.empty();
     411                            $searchLoader.show();
     412                            $searchInput.prop( 'disabled', true );
     413                            $( '.sui-pagination' ).remove();
     414                            $( '.sui-pagination-results' ).html('');
     415                            $( '#forminator-search-modules .search-reset' ).hide();
     416                        },
     417                        success: function( result ){
     418                            $searchLoader.hide();
     419                            $modulesList.html( result.data );
     420                            $( 'html' ).animate( { scrollTop: $modulesList.offset().top - 150 }, 300);
     421                            $( 'form[name="bulk-action-form"]' ).find( 'input[name="msearch"]' ).val( $searchKey );
     422                            $modulesList.find( '.module-actions input[name="msearch"]' ).val( $searchKey );
     423                            $searchInput.prop( 'disabled', false );
     424                            $( '.sui-pagination-results' ).html( window.singularPluralText(
     425                                                                    $modulesList.find( '.sui-accordion-item' ).length,
     426                                                                    Forminator.l10n.form.result,
     427                                                                    Forminator.l10n.form.results
     428                                                                 ) );
     429                            $( '#forminator-search-modules .search-reset' ).show();
     430                        }
     431                    });
     432                });
     433
     434                // Auto submit search after page reload from module actions (publish, duplicate, etc)
     435                if ( 0 !== $searchInput.length && 0 !== $searchKey.length ) {
     436                    $searchForm.submit();
     437                }
     438
     439                $( document ).on( 'click', '#forminator-search-modules .search-reset', function( e ) {
     440                    e.preventDefault();
     441                    window.location.href = $resetUrl;
     442                });
     443            }
     444
     445            // Open popup for Apply Appearance Preset action.
     446            $( document ).on( 'click', '.sui-box-search .sui-button', function( e ) {
     447                var action = $( 'select[name="forminator_action"]' ).val();
     448                if ( 'apply-preset-forms' === action ) {
     449                    e.preventDefault();
     450                    $( '#forminator_bulk_apply_preset' ).trigger( 'click' );
     451                }
     452            });
     453
     454        });
     455
     456        $( window ).on( 'load', function () {
     457            // On page load, trigger show submissions
     458            if (
     459                typeof window.Forminator === 'object' &&
     460                typeof window.Forminator.Utils === 'object' &&
     461                 'forminator-entries' === Forminator.Utils.get_url_param( 'page' ) &&
     462                 false === Forminator.Utils.get_url_param( 'form_type' ) &&
     463                 false === Forminator.Utils.get_url_param( 'form_id' )
     464               ) {
     465                $( '.show-submissions' ).trigger( 'click' );
     466            }
     467        });
     468
     469        /*
     470         * Refresh page when back button is used
     471         * @url https://stackoverflow.com/questions/43043113/how-to-force-reloading-a-page-when-using-browser-back-button
     472         */
     473        $( window ).on( 'pageshow', function ( event ) {
     474            if ( event.persisted ||
     475                 ( typeof window.performance != "undefined" &&
     476                 window.performance.getEntriesByType("navigation")[0].type === "back_forward" )
     477               ) {
     478                window.location.reload();
     479            }
     480        });
     481
     482    }());
     483}( jQuery, document ));
     484
     485function copyToClipboard( data ) {
     486    var $temp = jQuery( '<input />' );
     487    jQuery( "body" ).append( $temp );
     488    $temp.val( data ).select();
     489    document.execCommand( "copy" );
     490    $temp.remove();
     491}
     492
     493function copyToClipboardModal( el ) {
     494    el.trigger( 'select' );
     495    document.execCommand( "copy" );
     496}
     497
     498// noinspection JSUnusedGlobalSymbols
     499var forminator_render_captcha = function () {
     500    // TODO: avoid conflict with another plugins that provide recaptcha
     501    //  notify forminator front that grecaptcha loaded. anc can be used
     502    jQuery('.forminator-g-recaptcha').each(function () {
     503        var size = jQuery( this ).data('size'),
     504            data = {
     505                sitekey: jQuery( this ).data('sitekey'),
     506                theme: jQuery( this ).data('theme'),
     507                badge: jQuery( this ).data('badge'),
     508                size: size
     509            };
     510
     511        if (data.sitekey !== "") {
     512            // noinspection Annotator
     513            var widget = window.grecaptcha.render( jQuery(this)[0], data );
     514        }
     515    });
     516};
  • forminator/trunk/requirejs/main.js

    r3028842 r3047085  
     1var formintorjs;(function () { if (!formintorjs || !formintorjs.requirejs) {
     2if (!formintorjs) { formintorjs = {}; } else { require = formintorjs; }
    13/** vim: et:ts=4:sw=4:sts=4
    24 * @license RequireJS 2.3.3 Copyright jQuery Foundation and other contributors.
    35 * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
    46 */
     7
     8// UPFRONT DEV NOTICE: do not replace with minified version, this needs to be full version for proper build!!!
     9
     10//Not using strict: uneven strict support in browsers, #392, and causes
     11//problems with requirejs.exec()/transpiler plugins that may not be strict.
     12/*jslint regexp: true, nomen: true, sloppy: true */
     13/*global window, navigator, document, importScripts, setTimeout, opera */
     14
     15var requirejs, require, define;
     16(function (global, setTimeout) {
     17    var req, s, head, baseElement, dataMain, src,
     18        interactiveScript, currentlyAddingScript, mainScript, subPath,
     19        version = '2.3.3',
     20        commentRegExp = /\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/mg,
     21        cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
     22        jsSuffixRegExp = /\.js$/,
     23        currDirRegExp = /^\.\//,
     24        op = Object.prototype,
     25        ostring = op.toString,
     26        hasOwn = op.hasOwnProperty,
     27        isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
     28        isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
     29        //PS3 indicates loaded and complete, but need to wait for complete
     30        //specifically. Sequence is 'loading', 'loaded', execution,
     31        // then 'complete'. The UA check is unfortunate, but not sure how
     32        //to feature test w/o causing perf issues.
     33        readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
     34                      /^complete$/ : /^(complete|loaded)$/,
     35        defContextName = '_',
     36        //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
     37        isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
     38        contexts = {},
     39        cfg = {},
     40        globalDefQueue = [],
     41        useInteractive = false;
     42
     43    //Could match something like ')//comment', do not lose the prefix to comment.
     44    function commentReplace(match, singlePrefix) {
     45        return singlePrefix || '';
     46    }
     47
     48    function isFunction(it) {
     49        return ostring.call(it) === '[object Function]';
     50    }
     51
     52    function isArray(it) {
     53        return ostring.call(it) === '[object Array]';
     54    }
     55
     56    /**
     57     * Helper function for iterating over an array. If the func returns
     58     * a true value, it will break out of the loop.
     59     */
     60    function each(ary, func) {
     61        if (ary) {
     62            var i;
     63            for (i = 0; i < ary.length; i += 1) {
     64                if (ary[i] && func(ary[i], i, ary)) {
     65                    break;
     66                }
     67            }
     68        }
     69    }
     70
     71    /**
     72     * Helper function for iterating over an array backwards. If the func
     73     * returns a true value, it will break out of the loop.
     74     */
     75    function eachReverse(ary, func) {
     76        if (ary) {
     77            var i;
     78            for (i = ary.length - 1; i > -1; i -= 1) {
     79                if (ary[i] && func(ary[i], i, ary)) {
     80                    break;
     81                }
     82            }
     83        }
     84    }
     85
     86    function hasProp(obj, prop) {
     87        return hasOwn.call(obj, prop);
     88    }
     89
     90    function getOwn(obj, prop) {
     91        return hasProp(obj, prop) && obj[prop];
     92    }
     93
     94    /**
     95     * Cycles over properties in an object and calls a function for each
     96     * property value. If the function returns a truthy value, then the
     97     * iteration is stopped.
     98     */
     99    function eachProp(obj, func) {
     100        var prop;
     101        for (prop in obj) {
     102            if (hasProp(obj, prop)) {
     103                if (func(obj[prop], prop)) {
     104                    break;
     105                }
     106            }
     107        }
     108    }
     109
     110    /**
     111     * Simple function to mix in properties from source into target,
     112     * but only if target does not already have a property of the same name.
     113     */
     114    function mixin(target, source, force, deepStringMixin) {
     115        if (source) {
     116            eachProp(source, function (value, prop) {
     117                if (force || !hasProp(target, prop)) {
     118                    if (deepStringMixin && typeof value === 'object' && value &&
     119                        !isArray(value) && !isFunction(value) &&
     120                        !(value instanceof RegExp)) {
     121
     122                        if (!target[prop]) {
     123                            target[prop] = {};
     124                        }
     125                        mixin(target[prop], value, force, deepStringMixin);
     126                    } else {
     127                        target[prop] = value;
     128                    }
     129                }
     130            });
     131        }
     132        return target;
     133    }
     134
     135    //Similar to Function.prototype.bind, but the 'this' object is specified
     136    //first, since it is easier to read/figure out what 'this' will be.
     137    function bind(obj, fn) {
     138        return function () {
     139            return fn.apply(obj, arguments);
     140        };
     141    }
     142
     143    function scripts() {
     144        return document.getElementsByTagName('script');
     145    }
     146
     147    function defaultOnError(err) {
     148        throw err;
     149    }
     150
     151    //Allow getting a global that is expressed in
     152    //dot notation, like 'a.b.c'.
     153    function getGlobal(value) {
     154        if (!value) {
     155            return value;
     156        }
     157        var g = global;
     158        each(value.split('.'), function (part) {
     159            g = g[part];
     160        });
     161        return g;
     162    }
     163
     164    /**
     165     * Constructs an error with a pointer to an URL with more information.
     166     * @param {String} id the error ID that maps to an ID on a web page.
     167     * @param {String} message human readable error.
     168     * @param {Error} [err] the original error, if there is one.
     169     *
     170     * @returns {Error}
     171     */
     172    function makeError(id, msg, err, requireModules) {
     173        var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
     174        e.requireType = id;
     175        e.requireModules = requireModules;
     176        if (err) {
     177            e.originalError = err;
     178        }
     179        return e;
     180    }
     181
     182    if (typeof define !== 'undefined') {
     183        //If a define is already in play via another AMD loader,
     184        //do not overwrite.
     185        return;
     186    }
     187
     188    if (typeof requirejs !== 'undefined') {
     189        if (isFunction(requirejs)) {
     190            //Do not overwrite an existing requirejs instance.
     191            return;
     192        }
     193        cfg = requirejs;
     194        requirejs = undefined;
     195    }
     196
     197    //Allow for a require config object
     198    if (typeof require !== 'undefined' && !isFunction(require)) {
     199        //assume it is a config object.
     200        cfg = require;
     201        require = undefined;
     202    }
     203
     204    function newContext(contextName) {
     205        var inCheckLoaded, Module, context, handlers,
     206            checkLoadedTimeoutId,
     207            config = {
     208                //Defaults. Do not set a default for map
     209                //config to speed up normalize(), which
     210                //will run faster if there is no default.
     211                waitSeconds: 7,
     212                baseUrl: './',
     213                paths: {},
     214                bundles: {},
     215                pkgs: {},
     216                shim: {},
     217                config: {}
     218            },
     219            registry = {},
     220            //registry of just enabled modules, to speed
     221            //cycle breaking code when lots of modules
     222            //are registered, but not activated.
     223            enabledRegistry = {},
     224            undefEvents = {},
     225            defQueue = [],
     226            defined = {},
     227            urlFetched = {},
     228            bundlesMap = {},
     229            requireCounter = 1,
     230            unnormalizedCounter = 1;
     231
     232        /**
     233         * Trims the . and .. from an array of path segments.
     234         * It will keep a leading path segment if a .. will become
     235         * the first path segment, to help with module name lookups,
     236         * which act like paths, but can be remapped. But the end result,
     237         * all paths that use this function should look normalized.
     238         * NOTE: this method MODIFIES the input array.
     239         * @param {Array} ary the array of path segments.
     240         */
     241        function trimDots(ary) {
     242            var i, part;
     243            for (i = 0; i < ary.length; i++) {
     244                part = ary[i];
     245                if (part === '.') {
     246                    ary.splice(i, 1);
     247                    i -= 1;
     248                } else if (part === '..') {
     249                    // If at the start, or previous value is still ..,
     250                    // keep them so that when converted to a path it may
     251                    // still work when converted to a path, even though
     252                    // as an ID it is less than ideal. In larger point
     253                    // releases, may be better to just kick out an error.
     254                    if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') {
     255                        continue;
     256                    } else if (i > 0) {
     257                        ary.splice(i - 1, 2);
     258                        i -= 2;
     259                    }
     260                }
     261            }
     262        }
     263
     264        /**
     265         * Given a relative module name, like ./something, normalize it to
     266         * a real name that can be mapped to a path.
     267         * @param {String} name the relative name
     268         * @param {String} baseName a real name that the name arg is relative
     269         * to.
     270         * @param {Boolean} applyMap apply the map config to the value. Should
     271         * only be done if this normalization is for a dependency ID.
     272         * @returns {String} normalized name
     273         */
     274        function normalize(name, baseName, applyMap) {
     275            var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
     276                foundMap, foundI, foundStarMap, starI, normalizedBaseParts,
     277                baseParts = (baseName && baseName.split('/')),
     278                map = config.map,
     279                starMap = map && map['*'];
     280
     281            //Adjust any relative paths.
     282            if (name) {
     283                name = name.split('/');
     284                lastIndex = name.length - 1;
     285
     286                // If wanting node ID compatibility, strip .js from end
     287                // of IDs. Have to do this here, and not in nameToUrl
     288                // because node allows either .js or non .js to map
     289                // to same file.
     290                if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
     291                    name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
     292                }
     293
     294                // Starts with a '.' so need the baseName
     295                if (name[0].charAt(0) === '.' && baseParts) {
     296                    //Convert baseName to array, and lop off the last part,
     297                    //so that . matches that 'directory' and not name of the baseName's
     298                    //module. For instance, baseName of 'one/two/three', maps to
     299                    //'one/two/three.js', but we want the directory, 'one/two' for
     300                    //this normalization.
     301                    normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
     302                    name = normalizedBaseParts.concat(name);
     303                }
     304
     305                trimDots(name);
     306                name = name.join('/');
     307            }
     308
     309            //Apply map config if available.
     310            if (applyMap && map && (baseParts || starMap)) {
     311                nameParts = name.split('/');
     312
     313                outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
     314                    nameSegment = nameParts.slice(0, i).join('/');
     315
     316                    if (baseParts) {
     317                        //Find the longest baseName segment match in the config.
     318                        //So, do joins on the biggest to smallest lengths of baseParts.
     319                        for (j = baseParts.length; j > 0; j -= 1) {
     320                            mapValue = getOwn(map, baseParts.slice(0, j).join('/'));
     321
     322                            //baseName segment has config, find if it has one for
     323                            //this name.
     324                            if (mapValue) {
     325                                mapValue = getOwn(mapValue, nameSegment);
     326                                if (mapValue) {
     327                                    //Match, update name to the new value.
     328                                    foundMap = mapValue;
     329                                    foundI = i;
     330                                    break outerLoop;
     331                                }
     332                            }
     333                        }
     334                    }
     335
     336                    //Check for a star map match, but just hold on to it,
     337                    //if there is a shorter segment match later in a matching
     338                    //config, then favor over this star map.
     339                    if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
     340                        foundStarMap = getOwn(starMap, nameSegment);
     341                        starI = i;
     342                    }
     343                }
     344
     345                if (!foundMap && foundStarMap) {
     346                    foundMap = foundStarMap;
     347                    foundI = starI;
     348                }
     349
     350                if (foundMap) {
     351                    nameParts.splice(0, foundI, foundMap);
     352                    name = nameParts.join('/');
     353                }
     354            }
     355
     356            // If the name points to a package's name, use
     357            // the package main instead.
     358            pkgMain = getOwn(config.pkgs, name);
     359
     360            return pkgMain ? pkgMain : name;
     361        }
     362
     363        function removeScript(name) {
     364            if (isBrowser) {
     365                each(scripts(), function (scriptNode) {
     366                    if (scriptNode.getAttribute('data-requiremodule') === name &&
     367                            scriptNode.getAttribute('data-requirecontext') === context.contextName) {
     368                        scriptNode.parentNode.removeChild(scriptNode);
     369                        return true;
     370                    }
     371                });
     372            }
     373        }
     374
     375        function hasPathFallback(id) {
     376            var pathConfig = getOwn(config.paths, id);
     377            if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
     378                //Pop off the first array value, since it failed, and
     379                //retry
     380                pathConfig.shift();
     381                context.require.undef(id);
     382
     383                //Custom require that does not do map translation, since
     384                //ID is "absolute", already mapped/resolved.
     385                context.makeRequire(null, {
     386                    skipMap: true
     387                })([id]);
     388
     389                return true;
     390            }
     391        }
     392
     393        //Turns a plugin!resource to [plugin, resource]
     394        //with the plugin being undefined if the name
     395        //did not have a plugin prefix.
     396        function splitPrefix(name) {
     397            var prefix,
     398                index = name ? name.indexOf('!') : -1;
     399            if (index > -1) {
     400                prefix = name.substring(0, index);
     401                name = name.substring(index + 1, name.length);
     402            }
     403            return [prefix, name];
     404        }
     405
     406        /**
     407         * Creates a module mapping that includes plugin prefix, module
     408         * name, and path. If parentModuleMap is provided it will
     409         * also normalize the name via require.normalize()
     410         *
     411         * @param {String} name the module name
     412         * @param {String} [parentModuleMap] parent module map
     413         * for the module name, used to resolve relative names.
     414         * @param {Boolean} isNormalized: is the ID already normalized.
     415         * This is true if this call is done for a define() module ID.
     416         * @param {Boolean} applyMap: apply the map config to the ID.
     417         * Should only be true if this map is for a dependency.
     418         *
     419         * @returns {Object}
     420         */
     421        function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
     422            var url, pluginModule, suffix, nameParts,
     423                prefix = null,
     424                parentName = parentModuleMap ? parentModuleMap.name : null,
     425                originalName = name,
     426                isDefine = true,
     427                normalizedName = '';
     428
     429            //If no name, then it means it is a require call, generate an
     430            //internal name.
     431            if (!name) {
     432                isDefine = false;
     433                name = '_@r' + (requireCounter += 1);
     434            }
     435
     436            nameParts = splitPrefix(name);
     437            prefix = nameParts[0];
     438            name = nameParts[1];
     439
     440            if (prefix) {
     441                prefix = normalize(prefix, parentName, applyMap);
     442                pluginModule = getOwn(defined, prefix);
     443            }
     444
     445            //Account for relative paths if there is a base name.
     446            if (name) {
     447                if (prefix) {
     448                    if (isNormalized) {
     449                        normalizedName = name;
     450                    } else if (pluginModule && pluginModule.normalize) {
     451                        //Plugin is loaded, use its normalize method.
     452                        normalizedName = pluginModule.normalize(name, function (name) {
     453                            return normalize(name, parentName, applyMap);
     454                        });
     455                    } else {
     456                        // If nested plugin references, then do not try to
     457                        // normalize, as it will not normalize correctly. This
     458                        // places a restriction on resourceIds, and the longer
     459                        // term solution is not to normalize until plugins are
     460                        // loaded and all normalizations to allow for async
     461                        // loading of a loader plugin. But for now, fixes the
     462                        // common uses. Details in #1131
     463                        normalizedName = name.indexOf('!') === -1 ?
     464                                         normalize(name, parentName, applyMap) :
     465                                         name;
     466                    }
     467                } else {
     468                    //A regular module.
     469                    normalizedName = normalize(name, parentName, applyMap);
     470
     471                    //Normalized name may be a plugin ID due to map config
     472                    //application in normalize. The map config values must
     473                    //already be normalized, so do not need to redo that part.
     474                    nameParts = splitPrefix(normalizedName);
     475                    prefix = nameParts[0];
     476                    normalizedName = nameParts[1];
     477                    isNormalized = true;
     478
     479                    url = context.nameToUrl(normalizedName);
     480                }
     481            }
     482
     483            //If the id is a plugin id that cannot be determined if it needs
     484            //normalization, stamp it with a unique ID so two matching relative
     485            //ids that may conflict can be separate.
     486            suffix = prefix && !pluginModule && !isNormalized ?
     487                     '_unnormalized' + (unnormalizedCounter += 1) :
     488                     '';
     489
     490            return {
     491                prefix: prefix,
     492                name: normalizedName,
     493                parentMap: parentModuleMap,
     494                unnormalized: !!suffix,
     495                url: url,
     496                originalName: originalName,
     497                isDefine: isDefine,
     498                id: (prefix ?
     499                        prefix + '!' + normalizedName :
     500                        normalizedName) + suffix
     501            };
     502        }
     503
     504        function getModule(depMap) {
     505            var id = depMap.id,
     506                mod = getOwn(registry, id);
     507
     508            if (!mod) {
     509                mod = registry[id] = new context.Module(depMap);
     510            }
     511
     512            return mod;
     513        }
     514
     515        function on(depMap, name, fn) {
     516            var id = depMap.id,
     517                mod = getOwn(registry, id);
     518
     519            if (hasProp(defined, id) &&
     520                    (!mod || mod.defineEmitComplete)) {
     521                if (name === 'defined') {
     522                    fn(defined[id]);
     523                }
     524            } else {
     525                mod = getModule(depMap);
     526                if (mod.error && name === 'error') {
     527                    fn(mod.error);
     528                } else {
     529                    mod.on(name, fn);
     530                }
     531            }
     532        }
     533
     534        function onError(err, errback) {
     535            var ids = err.requireModules,
     536                notified = false;
     537
     538            if (errback) {
     539                errback(err);
     540            } else {
     541                each(ids, function (id) {
     542                    var mod = getOwn(registry, id);
     543                    if (mod) {
     544                        //Set error on module, so it skips timeout checks.
     545                        mod.error = err;
     546                        if (mod.events.error) {
     547                            notified = true;
     548                            mod.emit('error', err);
     549                        }
     550                    }
     551                });
     552
     553                if (!notified) {
     554                    req.onError(err);
     555                }
     556            }
     557        }
     558
     559        /**
     560         * Internal method to transfer globalQueue items to this context's
     561         * defQueue.
     562         */
     563        function takeGlobalQueue() {
     564            //Push all the globalDefQueue items into the context's defQueue
     565            if (globalDefQueue.length) {
     566                each(globalDefQueue, function(queueItem) {
     567                    var id = queueItem[0];
     568                    if (typeof id === 'string') {
     569                        context.defQueueMap[id] = true;
     570                    }
     571                    defQueue.push(queueItem);
     572                });
     573                globalDefQueue = [];
     574            }
     575        }
     576
     577        handlers = {
     578            'require': function (mod) {
     579                if (mod.require) {
     580                    return mod.require;
     581                } else {
     582                    return (mod.require = context.makeRequire(mod.map));
     583                }
     584            },
     585            'exports': function (mod) {
     586                mod.usingExports = true;
     587                if (mod.map.isDefine) {
     588                    if (mod.exports) {
     589                        return (defined[mod.map.id] = mod.exports);
     590                    } else {
     591                        return (mod.exports = defined[mod.map.id] = {});
     592                    }
     593                }
     594            },
     595            'module': function (mod) {
     596                if (mod.module) {
     597                    return mod.module;
     598                } else {
     599                    return (mod.module = {
     600                        id: mod.map.id,
     601                        uri: mod.map.url,
     602                        config: function () {
     603                            return getOwn(config.config, mod.map.id) || {};
     604                        },
     605                        exports: mod.exports || (mod.exports = {})
     606                    });
     607                }
     608            }
     609        };
     610
     611        function cleanRegistry(id) {
     612            //Clean up machinery used for waiting modules.
     613            delete registry[id];
     614            delete enabledRegistry[id];
     615        }
     616
     617        function breakCycle(mod, traced, processed) {
     618            var id = mod.map.id;
     619
     620            if (mod.error) {
     621                mod.emit('error', mod.error);
     622            } else {
     623                traced[id] = true;
     624                each(mod.depMaps, function (depMap, i) {
     625                    var depId = depMap.id,
     626                        dep = getOwn(registry, depId);
     627
     628                    //Only force things that have not completed
     629                    //being defined, so still in the registry,
     630                    //and only if it has not been matched up
     631                    //in the module already.
     632                    if (dep && !mod.depMatched[i] && !processed[depId]) {
     633                        if (getOwn(traced, depId)) {
     634                            mod.defineDep(i, defined[depId]);
     635                            mod.check(); //pass false?
     636                        } else {
     637                            breakCycle(dep, traced, processed);
     638                        }
     639                    }
     640                });
     641                processed[id] = true;
     642            }
     643        }
     644
     645        function checkLoaded() {
     646            var err, usingPathFallback,
     647                waitInterval = config.waitSeconds * 1000,
     648                //It is possible to disable the wait interval by using waitSeconds of 0.
     649                expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
     650                noLoads = [],
     651                reqCalls = [],
     652                stillLoading = false,
     653                needCycleCheck = true;
     654
     655            //Do not bother if this call was a result of a cycle break.
     656            if (inCheckLoaded) {
     657                return;
     658            }
     659
     660            inCheckLoaded = true;
     661
     662            //Figure out the state of all the modules.
     663            eachProp(enabledRegistry, function (mod) {
     664                var map = mod.map,
     665                    modId = map.id;
     666
     667                //Skip things that are not enabled or in error state.
     668                if (!mod.enabled) {
     669                    return;
     670                }
     671
     672                if (!map.isDefine) {
     673                    reqCalls.push(mod);
     674                }
     675
     676                if (!mod.error) {
     677                    //If the module should be executed, and it has not
     678                    //been inited and time is up, remember it.
     679                    if (!mod.inited && expired) {
     680                        if (hasPathFallback(modId)) {
     681                            usingPathFallback = true;
     682                            stillLoading = true;
     683                        } else {
     684                            noLoads.push(modId);
     685                            removeScript(modId);
     686                        }
     687                    } else if (!mod.inited && mod.fetched && map.isDefine) {
     688                        stillLoading = true;
     689                        if (!map.prefix) {
     690                            //No reason to keep looking for unfinished
     691                            //loading. If the only stillLoading is a
     692                            //plugin resource though, keep going,
     693                            //because it may be that a plugin resource
     694                            //is waiting on a non-plugin cycle.
     695                            return (needCycleCheck = false);
     696                        }
     697                    }
     698                }
     699            });
     700
     701            if (expired && noLoads.length) {
     702                //If wait time expired, throw error of unloaded modules.
     703                err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
     704                err.contextName = context.contextName;
     705                return onError(err);
     706            }
     707
     708            //Not expired, check for a cycle.
     709            if (needCycleCheck) {
     710                each(reqCalls, function (mod) {
     711                    breakCycle(mod, {}, {});
     712                });
     713            }
     714
     715            //If still waiting on loads, and the waiting load is something
     716            //other than a plugin resource, or there are still outstanding
     717            //scripts, then just try back later.
     718            if ((!expired || usingPathFallback) && stillLoading) {
     719                //Something is still waiting to load. Wait for it, but only
     720                //if a timeout is not already in effect.
     721                if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
     722                    checkLoadedTimeoutId = setTimeout(function () {
     723                        checkLoadedTimeoutId = 0;
     724                        checkLoaded();
     725                    }, 50);
     726                }
     727            }
     728
     729            inCheckLoaded = false;
     730        }
     731
     732        Module = function (map) {
     733            this.events = getOwn(undefEvents, map.id) || {};
     734            this.map = map;
     735            this.shim = getOwn(config.shim, map.id);
     736            this.depExports = [];
     737            this.depMaps = [];
     738            this.depMatched = [];
     739            this.pluginMaps = {};
     740            this.depCount = 0;
     741
     742            /* this.exports this.factory
     743               this.depMaps = [],
     744               this.enabled, this.fetched
     745            */
     746        };
     747
     748        Module.prototype = {
     749            init: function (depMaps, factory, errback, options) {
     750                options = options || {};
     751
     752                //Do not do more inits if already done. Can happen if there
     753                //are multiple define calls for the same module. That is not
     754                //a normal, common case, but it is also not unexpected.
     755                if (this.inited) {
     756                    return;
     757                }
     758
     759                this.factory = factory;
     760
     761                if (errback) {
     762                    //Register for errors on this module.
     763                    this.on('error', errback);
     764                } else if (this.events.error) {
     765                    //If no errback already, but there are error listeners
     766                    //on this module, set up an errback to pass to the deps.
     767                    errback = bind(this, function (err) {
     768                        this.emit('error', err);
     769                    });
     770                }
     771
     772                //Do a copy of the dependency array, so that
     773                //source inputs are not modified. For example
     774                //"shim" deps are passed in here directly, and
     775                //doing a direct modification of the depMaps array
     776                //would affect that config.
     777                this.depMaps = depMaps && depMaps.slice(0);
     778
     779                this.errback = errback;
     780
     781                //Indicate this module has be initialized
     782                this.inited = true;
     783
     784                this.ignore = options.ignore;
     785
     786                //Could have option to init this module in enabled mode,
     787                //or could have been previously marked as enabled. However,
     788                //the dependencies are not known until init is called. So
     789                //if enabled previously, now trigger dependencies as enabled.
     790                if (options.enabled || this.enabled) {
     791                    //Enable this module and dependencies.
     792                    //Will call this.check()
     793                    this.enable();
     794                } else {
     795                    this.check();
     796                }
     797            },
     798
     799            defineDep: function (i, depExports) {
     800                //Because of cycles, defined callback for a given
     801                //export can be called more than once.
     802                if (!this.depMatched[i]) {
     803                    this.depMatched[i] = true;
     804                    this.depCount -= 1;
     805                    this.depExports[i] = depExports;
     806                }
     807            },
     808
     809            fetch: function () {
     810                if (this.fetched) {
     811                    return;
     812                }
     813                this.fetched = true;
     814
     815                context.startTime = (new Date()).getTime();
     816
     817                var map = this.map;
     818
     819                //If the manager is for a plugin managed resource,
     820                //ask the plugin to load it now.
     821                if (this.shim) {
     822                    context.makeRequire(this.map, {
     823                        enableBuildCallback: true
     824                    })(this.shim.deps || [], bind(this, function () {
     825                        return map.prefix ? this.callPlugin() : this.load();
     826                    }));
     827                } else {
     828                    //Regular dependency.
     829                    return map.prefix ? this.callPlugin() : this.load();
     830                }
     831            },
     832
     833            load: function () {
     834                var url = this.map.url;
     835
     836                //Regular dependency.
     837                if (!urlFetched[url]) {
     838                    urlFetched[url] = true;
     839                    context.load(this.map.id, url);
     840                }
     841            },
     842
     843            /**
     844             * Checks if the module is ready to define itself, and if so,
     845             * define it.
     846             */
     847            check: function () {
     848                if (!this.enabled || this.enabling) {
     849                    return;
     850                }
     851
     852                var err, cjsModule,
     853                    id = this.map.id,
     854                    depExports = this.depExports,
     855                    exports = this.exports,
     856                    factory = this.factory;
     857
     858                if (!this.inited) {
     859                    // Only fetch if not already in the defQueue.
     860                    if (!hasProp(context.defQueueMap, id)) {
     861                        this.fetch();
     862                    }
     863                } else if (this.error) {
     864                    this.emit('error', this.error);
     865                } else if (!this.defining) {
     866                    //The factory could trigger another require call
     867                    //that would result in checking this module to
     868                    //define itself again. If already in the process
     869                    //of doing that, skip this work.
     870                    this.defining = true;
     871
     872                    if (this.depCount < 1 && !this.defined) {
     873                        if (isFunction(factory)) {
     874                            //If there is an error listener, favor passing
     875                            //to that instead of throwing an error. However,
     876                            //only do it for define()'d  modules. require
     877                            //errbacks should not be called for failures in
     878                            //their callbacks (#699). However if a global
     879                            //onError is set, use that.
     880                            if ((this.events.error && this.map.isDefine) ||
     881                                req.onError !== defaultOnError) {
     882                                try {
     883                                    exports = context.execCb(id, factory, depExports, exports);
     884                                } catch (e) {
     885                                    err = e;
     886                                }
     887                            } else {
     888                                exports = context.execCb(id, factory, depExports, exports);
     889                            }
     890
     891                            // Favor return value over exports. If node/cjs in play,
     892                            // then will not have a return value anyway. Favor
     893                            // module.exports assignment over exports object.
     894                            if (this.map.isDefine && exports === undefined) {
     895                                cjsModule = this.module;
     896                                if (cjsModule) {
     897                                    exports = cjsModule.exports;
     898                                } else if (this.usingExports) {
     899                                    //exports already set the defined value.
     900                                    exports = this.exports;
     901                                }
     902                            }
     903
     904                            if (err) {
     905                                err.requireMap = this.map;
     906                                err.requireModules = this.map.isDefine ? [this.map.id] : null;
     907                                err.requireType = this.map.isDefine ? 'define' : 'require';
     908                                return onError((this.error = err));
     909                            }
     910
     911                        } else {
     912                            //Just a literal value
     913                            exports = factory;
     914                        }
     915
     916                        this.exports = exports;
     917
     918                        if (this.map.isDefine && !this.ignore) {
     919                            defined[id] = exports;
     920
     921                            if (req.onResourceLoad) {
     922                                var resLoadMaps = [];
     923                                each(this.depMaps, function (depMap) {
     924                                    resLoadMaps.push(depMap.normalizedMap || depMap);
     925                                });
     926                                req.onResourceLoad(context, this.map, resLoadMaps);
     927                            }
     928                        }
     929
     930                        //Clean up
     931                        cleanRegistry(id);
     932
     933                        this.defined = true;
     934                    }
     935
     936                    //Finished the define stage. Allow calling check again
     937                    //to allow define notifications below in the case of a
     938                    //cycle.
     939                    this.defining = false;
     940
     941                    if (this.defined && !this.defineEmitted) {
     942                        this.defineEmitted = true;
     943                        this.emit('defined', this.exports);
     944                        this.defineEmitComplete = true;
     945                    }
     946
     947                }
     948            },
     949
     950            callPlugin: function () {
     951                var map = this.map,
     952                    id = map.id,
     953                    //Map already normalized the prefix.
     954                    pluginMap = makeModuleMap(map.prefix);
     955
     956                //Mark this as a dependency for this plugin, so it
     957                //can be traced for cycles.
     958                this.depMaps.push(pluginMap);
     959
     960                on(pluginMap, 'defined', bind(this, function (plugin) {
     961                    var load, normalizedMap, normalizedMod,
     962                        bundleId = getOwn(bundlesMap, this.map.id),
     963                        name = this.map.name,
     964                        parentName = this.map.parentMap ? this.map.parentMap.name : null,
     965                        localRequire = context.makeRequire(map.parentMap, {
     966                            enableBuildCallback: true
     967                        });
     968
     969                    //If current map is not normalized, wait for that
     970                    //normalized name to load instead of continuing.
     971                    if (this.map.unnormalized) {
     972                        //Normalize the ID if the plugin allows it.
     973                        if (plugin.normalize) {
     974                            name = plugin.normalize(name, function (name) {
     975                                return normalize(name, parentName, true);
     976                            }) || '';
     977                        }
     978
     979                        //prefix and name should already be normalized, no need
     980                        //for applying map config again either.
     981                        normalizedMap = makeModuleMap(map.prefix + '!' + name,
     982                                                      this.map.parentMap,
     983                                                      true);
     984                        on(normalizedMap,
     985                            'defined', bind(this, function (value) {
     986                                this.map.normalizedMap = normalizedMap;
     987                                this.init([], function () { return value; }, null, {
     988                                    enabled: true,
     989                                    ignore: true
     990                                });
     991                            }));
     992
     993                        normalizedMod = getOwn(registry, normalizedMap.id);
     994                        if (normalizedMod) {
     995                            //Mark this as a dependency for this plugin, so it
     996                            //can be traced for cycles.
     997                            this.depMaps.push(normalizedMap);
     998
     999                            if (this.events.error) {
     1000                                normalizedMod.on('error', bind(this, function (err) {
     1001                                    this.emit('error', err);
     1002                                }));
     1003                            }
     1004                            normalizedMod.enable();
     1005                        }
     1006
     1007                        return;
     1008                    }
     1009
     1010                    //If a paths config, then just load that file instead to
     1011                    //resolve the plugin, as it is built into that paths layer.
     1012                    if (bundleId) {
     1013                        this.map.url = context.nameToUrl(bundleId);
     1014                        this.load();
     1015                        return;
     1016                    }
     1017
     1018                    load = bind(this, function (value) {
     1019                        this.init([], function () { return value; }, null, {
     1020                            enabled: true
     1021                        });
     1022                    });
     1023
     1024                    load.error = bind(this, function (err) {
     1025                        this.inited = true;
     1026                        this.error = err;
     1027                        err.requireModules = [id];
     1028
     1029                        //Remove temp unnormalized modules for this module,
     1030                        //since they will never be resolved otherwise now.
     1031                        eachProp(registry, function (mod) {
     1032                            if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
     1033                                cleanRegistry(mod.map.id);
     1034                            }
     1035                        });
     1036
     1037                        onError(err);
     1038                    });
     1039
     1040                    //Allow plugins to load other code without having to know the
     1041                    //context or how to 'complete' the load.
     1042                    load.fromText = bind(this, function (text, textAlt) {
     1043                        /*jslint evil: true */
     1044                        var moduleName = map.name,
     1045                            moduleMap = makeModuleMap(moduleName),
     1046                            hasInteractive = useInteractive;
     1047
     1048                        //As of 2.1.0, support just passing the text, to reinforce
     1049                        //fromText only being called once per resource. Still
     1050                        //support old style of passing moduleName but discard
     1051                        //that moduleName in favor of the internal ref.
     1052                        if (textAlt) {
     1053                            text = textAlt;
     1054                        }
     1055
     1056                        //Turn off interactive script matching for IE for any define
     1057                        //calls in the text, then turn it back on at the end.
     1058                        if (hasInteractive) {
     1059                            useInteractive = false;
     1060                        }
     1061
     1062                        //Prime the system by creating a module instance for
     1063                        //it.
     1064                        getModule(moduleMap);
     1065
     1066                        //Transfer any config to this other module.
     1067                        if (hasProp(config.config, id)) {
     1068                            config.config[moduleName] = config.config[id];
     1069                        }
     1070
     1071                        try {
     1072                            req.exec(text);
     1073                        } catch (e) {
     1074                            return onError(makeError('fromtexteval',
     1075                                             'fromText eval for ' + id +
     1076                                            ' failed: ' + e,
     1077                                             e,
     1078                                             [id]));
     1079                        }
     1080
     1081                        if (hasInteractive) {
     1082                            useInteractive = true;
     1083                        }
     1084
     1085                        //Mark this as a dependency for the plugin
     1086                        //resource
     1087                        this.depMaps.push(moduleMap);
     1088
     1089                        //Support anonymous modules.
     1090                        context.completeLoad(moduleName);
     1091
     1092                        //Bind the value of that module to the value for this
     1093                        //resource ID.
     1094                        localRequire([moduleName], load);
     1095                    });
     1096
     1097                    //Use parentName here since the plugin's name is not reliable,
     1098                    //could be some weird string with no path that actually wants to
     1099                    //reference the parentName's path.
     1100                    plugin.load(map.name, localRequire, load, config);
     1101                }));
     1102
     1103                context.enable(pluginMap, this);
     1104                this.pluginMaps[pluginMap.id] = pluginMap;
     1105            },
     1106
     1107            enable: function () {
     1108                enabledRegistry[this.map.id] = this;
     1109                this.enabled = true;
     1110
     1111                //Set flag mentioning that the module is enabling,
     1112                //so that immediate calls to the defined callbacks
     1113                //for dependencies do not trigger inadvertent load
     1114                //with the depCount still being zero.
     1115                this.enabling = true;
     1116
     1117                //Enable each dependency
     1118                each(this.depMaps, bind(this, function (depMap, i) {
     1119                    var id, mod, handler;
     1120
     1121                    if (typeof depMap === 'string') {
     1122                        //Dependency needs to be converted to a depMap
     1123                        //and wired up to this module.
     1124                        depMap = makeModuleMap(depMap,
     1125                                               (this.map.isDefine ? this.map : this.map.parentMap),
     1126                                               false,
     1127                                               !this.skipMap);
     1128                        this.depMaps[i] = depMap;
     1129
     1130                        handler = getOwn(handlers, depMap.id);
     1131
     1132                        if (handler) {
     1133                            this.depExports[i] = handler(this);
     1134                            return;
     1135                        }
     1136
     1137                        this.depCount += 1;
     1138
     1139                        on(depMap, 'defined', bind(this, function (depExports) {
     1140                            if (this.undefed) {
     1141                                return;
     1142                            }
     1143                            this.defineDep(i, depExports);
     1144                            this.check();
     1145                        }));
     1146
     1147                        if (this.errback) {
     1148                            on(depMap, 'error', bind(this, this.errback));
     1149                        } else if (this.events.error) {
     1150                            // No direct errback on this module, but something
     1151                            // else is listening for errors, so be sure to
     1152                            // propagate the error correctly.
     1153                            on(depMap, 'error', bind(this, function(err) {
     1154                                this.emit('error', err);
     1155                            }));
     1156                        }
     1157                    }
     1158
     1159                    id = depMap.id;
     1160                    mod = registry[id];
     1161
     1162                    //Skip special modules like 'require', 'exports', 'module'
     1163                    //Also, don't call enable if it is already enabled,
     1164                    //important in circular dependency cases.
     1165                    if (!hasProp(handlers, id) && mod && !mod.enabled) {
     1166                        context.enable(depMap, this);
     1167                    }
     1168                }));
     1169
     1170                //Enable each plugin that is used in
     1171                //a dependency
     1172                eachProp(this.pluginMaps, bind(this, function (pluginMap) {
     1173                    var mod = getOwn(registry, pluginMap.id);
     1174                    if (mod && !mod.enabled) {
     1175                        context.enable(pluginMap, this);
     1176                    }
     1177                }));
     1178
     1179                this.enabling = false;
     1180
     1181                this.check();
     1182            },
     1183
     1184            on: function (name, cb) {
     1185                var cbs = this.events[name];
     1186                if (!cbs) {
     1187                    cbs = this.events[name] = [];
     1188                }
     1189                cbs.push(cb);
     1190            },
     1191
     1192            emit: function (name, evt) {
     1193                each(this.events[name], function (cb) {
     1194                    cb(evt);
     1195                });
     1196                if (name === 'error') {
     1197                    //Now that the error handler was triggered, remove
     1198                    //the listeners, since this broken Module instance
     1199                    //can stay around for a while in the registry.
     1200                    delete this.events[name];
     1201                }
     1202            }
     1203        };
     1204
     1205        function callGetModule(args) {
     1206            //Skip modules already defined.
     1207            if (!hasProp(defined, args[0])) {
     1208                getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
     1209            }
     1210        }
     1211
     1212        function removeListener(node, func, name, ieName) {
     1213            //Favor detachEvent because of IE9
     1214            //issue, see attachEvent/addEventListener comment elsewhere
     1215            //in this file.
     1216            if (node.detachEvent && !isOpera) {
     1217                //Probably IE. If not it will throw an error, which will be
     1218                //useful to know.
     1219                if (ieName) {
     1220                    node.detachEvent(ieName, func);
     1221                }
     1222            } else {
     1223                node.removeEventListener(name, func, false);
     1224            }
     1225        }
     1226
     1227        /**
     1228         * Given an event from a script node, get the requirejs info from it,
     1229         * and then removes the event listeners on the node.
     1230         * @param {Event} evt
     1231         * @returns {Object}
     1232         */
     1233        function getScriptData(evt) {
     1234            //Using currentTarget instead of target for Firefox 2.0's sake. Not
     1235            //all old browsers will be supported, but this one was easy enough
     1236            //to support and still makes sense.
     1237            var node = evt.currentTarget || evt.srcElement;
     1238
     1239            //Remove the listeners once here.
     1240            removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
     1241            removeListener(node, context.onScriptError, 'error');
     1242
     1243            return {
     1244                node: node,
     1245                id: node && node.getAttribute('data-requiremodule')
     1246            };
     1247        }
     1248
     1249        function intakeDefines() {
     1250            var args;
     1251
     1252            //Any defined modules in the global queue, intake them now.
     1253            takeGlobalQueue();
     1254
     1255            //Make sure any remaining defQueue items get properly processed.
     1256            while (defQueue.length) {
     1257                args = defQueue.shift();
     1258                if (args[0] === null) {
     1259                    return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' +
     1260                        args[args.length - 1]));
     1261                } else {
     1262                    //args are id, deps, factory. Should be normalized by the
     1263                    //define() function.
     1264                    callGetModule(args);
     1265                }
     1266            }
     1267            context.defQueueMap = {};
     1268        }
     1269
     1270        context = {
     1271            config: config,
     1272            contextName: contextName,
     1273            registry: registry,
     1274            defined: defined,
     1275            urlFetched: urlFetched,
     1276            defQueue: defQueue,
     1277            defQueueMap: {},
     1278            Module: Module,
     1279            makeModuleMap: makeModuleMap,
     1280            nextTick: req.nextTick,
     1281            onError: onError,
     1282
     1283            /**
     1284             * Set a configuration for the context.
     1285             * @param {Object} cfg config object to integrate.
     1286             */
     1287            configure: function (cfg) {
     1288                //Make sure the baseUrl ends in a slash.
     1289                if (cfg.baseUrl) {
     1290                    if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
     1291                        cfg.baseUrl += '/';
     1292                    }
     1293                }
     1294
     1295                // Convert old style urlArgs string to a function.
     1296                if (typeof cfg.urlArgs === 'string') {
     1297                    var urlArgs = cfg.urlArgs;
     1298                    cfg.urlArgs = function(id, url) {
     1299                        return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs;
     1300                    };
     1301                }
     1302
     1303                //Save off the paths since they require special processing,
     1304                //they are additive.
     1305                var shim = config.shim,
     1306                    objs = {
     1307                        paths: true,
     1308                        bundles: true,
     1309                        config: true,
     1310                        map: true
     1311                    };
     1312
     1313                eachProp(cfg, function (value, prop) {
     1314                    if (objs[prop]) {
     1315                        if (!config[prop]) {
     1316                            config[prop] = {};
     1317                        }
     1318                        mixin(config[prop], value, true, true);
     1319                    } else {
     1320                        config[prop] = value;
     1321                    }
     1322                });
     1323
     1324                //Reverse map the bundles
     1325                if (cfg.bundles) {
     1326                    eachProp(cfg.bundles, function (value, prop) {
     1327                        each(value, function (v) {
     1328                            if (v !== prop) {
     1329                                bundlesMap[v] = prop;
     1330                            }
     1331                        });
     1332                    });
     1333                }
     1334
     1335                //Merge shim
     1336                if (cfg.shim) {
     1337                    eachProp(cfg.shim, function (value, id) {
     1338                        //Normalize the structure
     1339                        if (isArray(value)) {
     1340                            value = {
     1341                                deps: value
     1342                            };
     1343                        }
     1344                        if ((value.exports || value.init) && !value.exportsFn) {
     1345                            value.exportsFn = context.makeShimExports(value);
     1346                        }
     1347                        shim[id] = value;
     1348                    });
     1349                    config.shim = shim;
     1350                }
     1351
     1352                //Adjust packages if necessary.
     1353                if (cfg.packages) {
     1354                    each(cfg.packages, function (pkgObj) {
     1355                        var location, name;
     1356
     1357                        pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj;
     1358
     1359                        name = pkgObj.name;
     1360                        location = pkgObj.location;
     1361                        if (location) {
     1362                            config.paths[name] = pkgObj.location;
     1363                        }
     1364
     1365                        //Save pointer to main module ID for pkg name.
     1366                        //Remove leading dot in main, so main paths are normalized,
     1367                        //and remove any trailing .js, since different package
     1368                        //envs have different conventions: some use a module name,
     1369                        //some use a file name.
     1370                        config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
     1371                                     .replace(currDirRegExp, '')
     1372                                     .replace(jsSuffixRegExp, '');
     1373                    });
     1374                }
     1375
     1376                //If there are any "waiting to execute" modules in the registry,
     1377                //update the maps for them, since their info, like URLs to load,
     1378                //may have changed.
     1379                eachProp(registry, function (mod, id) {
     1380                    //If module already has init called, since it is too
     1381                    //late to modify them, and ignore unnormalized ones
     1382                    //since they are transient.
     1383                    if (!mod.inited && !mod.map.unnormalized) {
     1384                        mod.map = makeModuleMap(id, null, true);
     1385                    }
     1386                });
     1387
     1388                //If a deps array or a config callback is specified, then call
     1389                //require with those args. This is useful when require is defined as a
     1390                //config object before require.js is loaded.
     1391                if (cfg.deps || cfg.callback) {
     1392                    context.require(cfg.deps || [], cfg.callback);
     1393                }
     1394            },
     1395
     1396            makeShimExports: function (value) {
     1397                function fn() {
     1398                    var ret;
     1399                    if (value.init) {
     1400                        ret = value.init.apply(global, arguments);
     1401                    }
     1402                    return ret || (value.exports && getGlobal(value.exports));
     1403                }
     1404                return fn;
     1405            },
     1406
     1407            makeRequire: function (relMap, options) {
     1408                options = options || {};
     1409
     1410                function localRequire(deps, callback, errback) {
     1411                    var id, map, requireMod;
     1412
     1413                    if (options.enableBuildCallback && callback && isFunction(callback)) {
     1414                        callback.__requireJsBuild = true;
     1415                    }
     1416
     1417                    if (typeof deps === 'string') {
     1418                        if (isFunction(callback)) {
     1419                            //Invalid call
     1420                            return onError(makeError('requireargs', 'Invalid require call'), errback);
     1421                        }
     1422
     1423                        //If require|exports|module are requested, get the
     1424                        //value for them from the special handlers. Caveat:
     1425                        //this only works while module is being defined.
     1426                        if (relMap && hasProp(handlers, deps)) {
     1427                            return handlers[deps](registry[relMap.id]);
     1428                        }
     1429
     1430                        //Synchronous access to one module. If require.get is
     1431                        //available (as in the Node adapter), prefer that.
     1432                        if (req.get) {
     1433                            return req.get(context, deps, relMap, localRequire);
     1434                        }
     1435
     1436                        //Normalize module name, if it contains . or ..
     1437                        map = makeModuleMap(deps, relMap, false, true);
     1438                        id = map.id;
     1439
     1440                        if (!hasProp(defined, id)) {
     1441                            return onError(makeError('notloaded', 'Module name "' +
     1442                                        id +
     1443                                        '" has not been loaded yet for context: ' +
     1444                                        contextName +
     1445                                        (relMap ? '' : '. Use require([])')));
     1446                        }
     1447                        return defined[id];
     1448                    }
     1449
     1450                    //Grab defines waiting in the global queue.
     1451                    intakeDefines();
     1452
     1453                    //Mark all the dependencies as needing to be loaded.
     1454                    context.nextTick(function () {
     1455                        //Some defines could have been added since the
     1456                        //require call, collect them.
     1457                        intakeDefines();
     1458
     1459                        requireMod = getModule(makeModuleMap(null, relMap));
     1460
     1461                        //Store if map config should be applied to this require
     1462                        //call for dependencies.
     1463                        requireMod.skipMap = options.skipMap;
     1464
     1465                        requireMod.init(deps, callback, errback, {
     1466                            enabled: true
     1467                        });
     1468
     1469                        checkLoaded();
     1470                    });
     1471
     1472                    return localRequire;
     1473                }
     1474
     1475                mixin(localRequire, {
     1476                    isBrowser: isBrowser,
     1477
     1478                    /**
     1479                     * Converts a module name + .extension into an URL path.
     1480                     * *Requires* the use of a module name. It does not support using
     1481                     * plain URLs like nameToUrl.
     1482                     */
     1483                    toUrl: function (moduleNamePlusExt) {
     1484                        var ext,
     1485                            index = moduleNamePlusExt.lastIndexOf('.'),
     1486                            segment = moduleNamePlusExt.split('/')[0],
     1487                            isRelative = segment === '.' || segment === '..';
     1488
     1489                        //Have a file extension alias, and it is not the
     1490                        //dots from a relative path.
     1491                        if (index !== -1 && (!isRelative || index > 1)) {
     1492                            ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
     1493                            moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
     1494                        }
     1495
     1496                        return context.nameToUrl(normalize(moduleNamePlusExt,
     1497                                                relMap && relMap.id, true), ext,  true);
     1498                    },
     1499
     1500                    defined: function (id) {
     1501                        return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
     1502                    },
     1503
     1504                    specified: function (id) {
     1505                        id = makeModuleMap(id, relMap, false, true).id;
     1506                        return hasProp(defined, id) || hasProp(registry, id);
     1507                    }
     1508                });
     1509
     1510                //Only allow undef on top level require calls
     1511                if (!relMap) {
     1512                    localRequire.undef = function (id) {
     1513                        //Bind any waiting define() calls to this context,
     1514                        //fix for #408
     1515                        takeGlobalQueue();
     1516
     1517                        var map = makeModuleMap(id, relMap, true),
     1518                            mod = getOwn(registry, id);
     1519
     1520                        mod.undefed = true;
     1521                        removeScript(id);
     1522
     1523                        delete defined[id];
     1524                        delete urlFetched[map.url];
     1525                        delete undefEvents[id];
     1526
     1527                        //Clean queued defines too. Go backwards
     1528                        //in array so that the splices do not
     1529                        //mess up the iteration.
     1530                        eachReverse(defQueue, function(args, i) {
     1531                            if (args[0] === id) {
     1532                                defQueue.splice(i, 1);
     1533                            }
     1534                        });
     1535                        delete context.defQueueMap[id];
     1536
     1537                        if (mod) {
     1538                            //Hold on to listeners in case the
     1539                            //module will be attempted to be reloaded
     1540                            //using a different config.
     1541                            if (mod.events.defined) {
     1542                                undefEvents[id] = mod.events;
     1543                            }
     1544
     1545                            cleanRegistry(id);
     1546                        }
     1547                    };
     1548                }
     1549
     1550                return localRequire;
     1551            },
     1552
     1553            /**
     1554             * Called to enable a module if it is still in the registry
     1555             * awaiting enablement. A second arg, parent, the parent module,
     1556             * is passed in for context, when this method is overridden by
     1557             * the optimizer. Not shown here to keep code compact.
     1558             */
     1559            enable: function (depMap) {
     1560                var mod = getOwn(registry, depMap.id);
     1561                if (mod) {
     1562                    getModule(depMap).enable();
     1563                }
     1564            },
     1565
     1566            /**
     1567             * Internal method used by environment adapters to complete a load event.
     1568             * A load event could be a script load or just a load pass from a synchronous
     1569             * load call.
     1570             * @param {String} moduleName the name of the module to potentially complete.
     1571             */
     1572            completeLoad: function (moduleName) {
     1573                var found, args, mod,
     1574                    shim = getOwn(config.shim, moduleName) || {},
     1575                    shExports = shim.exports;
     1576
     1577                takeGlobalQueue();
     1578
     1579                while (defQueue.length) {
     1580                    args = defQueue.shift();
     1581                    if (args[0] === null) {
     1582                        args[0] = moduleName;
     1583                        //If already found an anonymous module and bound it
     1584                        //to this name, then this is some other anon module
     1585                        //waiting for its completeLoad to fire.
     1586                        if (found) {
     1587                            break;
     1588                        }
     1589                        found = true;
     1590                    } else if (args[0] === moduleName) {
     1591                        //Found matching define call for this script!
     1592                        found = true;
     1593                    }
     1594
     1595                    callGetModule(args);
     1596                }
     1597                context.defQueueMap = {};
     1598
     1599                //Do this after the cycle of callGetModule in case the result
     1600                //of those calls/init calls changes the registry.
     1601                mod = getOwn(registry, moduleName);
     1602
     1603                if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
     1604                    if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
     1605                        if (hasPathFallback(moduleName)) {
     1606                            return;
     1607                        } else {
     1608                            return onError(makeError('nodefine',
     1609                                             'No define call for ' + moduleName,
     1610                                             null,
     1611                                             [moduleName]));
     1612                        }
     1613                    } else {
     1614                        //A script that does not call define(), so just simulate
     1615                        //the call for it.
     1616                        callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
     1617                    }
     1618                }
     1619
     1620                checkLoaded();
     1621            },
     1622
     1623            /**
     1624             * Converts a module name to a file path. Supports cases where
     1625             * moduleName may actually be just an URL.
     1626             * Note that it **does not** call normalize on the moduleName,
     1627             * it is assumed to have already been normalized. This is an
     1628             * internal API, not a public one. Use toUrl for the public API.
     1629             */
     1630            nameToUrl: function (moduleName, ext, skipExt) {
     1631                var paths, syms, i, parentModule, url,
     1632                    parentPath, bundleId,
     1633                    pkgMain = getOwn(config.pkgs, moduleName);
     1634
     1635                if (pkgMain) {
     1636                    moduleName = pkgMain;
     1637                }
     1638
     1639                bundleId = getOwn(bundlesMap, moduleName);
     1640
     1641                if (bundleId) {
     1642                    return context.nameToUrl(bundleId, ext, skipExt);
     1643                }
     1644
     1645                //If a colon is in the URL, it indicates a protocol is used and it is just
     1646                //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
     1647                //or ends with .js, then assume the user meant to use an url and not a module id.
     1648                //The slash is important for protocol-less URLs as well as full paths.
     1649                if (req.jsExtRegExp.test(moduleName)) {
     1650                    //Just a plain path, not module name lookup, so just return it.
     1651                    //Add extension if it is included. This is a bit wonky, only non-.js things pass
     1652                    //an extension, this method probably needs to be reworked.
     1653                    url = moduleName + (ext || '');
     1654                } else {
     1655                    //A module that needs to be converted to a path.
     1656                    paths = config.paths;
     1657
     1658                    syms = moduleName.split('/');
     1659                    //For each module name segment, see if there is a path
     1660                    //registered for it. Start with most specific name
     1661                    //and work up from it.
     1662                    for (i = syms.length; i > 0; i -= 1) {
     1663                        parentModule = syms.slice(0, i).join('/');
     1664
     1665                        parentPath = getOwn(paths, parentModule);
     1666                        if (parentPath) {
     1667                            //If an array, it means there are a few choices,
     1668                            //Choose the one that is desired
     1669                            if (isArray(parentPath)) {
     1670                                parentPath = parentPath[0];
     1671                            }
     1672                            syms.splice(0, i, parentPath);
     1673                            break;
     1674                        }
     1675                    }
     1676
     1677                    //Join the path parts together, then figure out if baseUrl is needed.
     1678                    url = syms.join('/');
     1679                    url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js'));
     1680                    url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
     1681                }
     1682
     1683                return config.urlArgs && !/^blob\:/.test(url) ?
     1684                       url + config.urlArgs(moduleName, url) : url;
     1685            },
     1686
     1687            //Delegates to req.load. Broken out as a separate function to
     1688            //allow overriding in the optimizer.
     1689            load: function (id, url) {
     1690                req.load(context, id, url);
     1691            },
     1692
     1693            /**
     1694             * Executes a module callback function. Broken out as a separate function
     1695             * solely to allow the build system to sequence the files in the built
     1696             * layer in the right sequence.
     1697             *
     1698             * @private
     1699             */
     1700            execCb: function (name, callback, args, exports) {
     1701                return callback.apply(exports, args);
     1702            },
     1703
     1704            /**
     1705             * callback for script loads, used to check status of loading.
     1706             *
     1707             * @param {Event} evt the event from the browser for the script
     1708             * that was loaded.
     1709             */
     1710            onScriptLoad: function (evt) {
     1711                //Using currentTarget instead of target for Firefox 2.0's sake. Not
     1712                //all old browsers will be supported, but this one was easy enough
     1713                //to support and still makes sense.
     1714                if (evt.type === 'load' ||
     1715                        (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
     1716                    //Reset interactive script so a script node is not held onto for
     1717                    //to long.
     1718                    interactiveScript = null;
     1719
     1720                    //Pull out the name of the module and the context.
     1721                    var data = getScriptData(evt);
     1722                    context.completeLoad(data.id);
     1723                }
     1724            },
     1725
     1726            /**
     1727             * Callback for script errors.
     1728             */
     1729            onScriptError: function (evt) {
     1730                var data = getScriptData(evt);
     1731                if (!hasPathFallback(data.id)) {
     1732                    var parents = [];
     1733                    eachProp(registry, function(value, key) {
     1734                        if (key.indexOf('_@r') !== 0) {
     1735                            each(value.depMaps, function(depMap) {
     1736                                if (depMap.id === data.id) {
     1737                                    parents.push(key);
     1738                                    return true;
     1739                                }
     1740                            });
     1741                        }
     1742                    });
     1743                    return onError(makeError('scripterror', 'Script error for "' + data.id +
     1744                                             (parents.length ?
     1745                                             '", needed by: ' + parents.join(', ') :
     1746                                             '"'), evt, [data.id]));
     1747                }
     1748            }
     1749        };
     1750
     1751        context.require = context.makeRequire();
     1752        return context;
     1753    }
     1754
     1755    /**
     1756     * Main entry point.
     1757     *
     1758     * If the only argument to require is a string, then the module that
     1759     * is represented by that string is fetched for the appropriate context.
     1760     *
     1761     * If the first argument is an array, then it will be treated as an array
     1762     * of dependency string names to fetch. An optional function callback can
     1763     * be specified to execute when all of those dependencies are available.
     1764     *
     1765     * Make a local req variable to help Caja compliance (it assumes things
     1766     * on a require that are not standardized), and to give a short
     1767     * name for minification/local scope use.
     1768     */
     1769    req = requirejs = function (deps, callback, errback, optional) {
     1770
     1771        //Find the right context, use default
     1772        var context, config,
     1773            contextName = defContextName;
     1774
     1775        // Determine if have config object in the call.
     1776        if (!isArray(deps) && typeof deps !== 'string') {
     1777            // deps is a config object
     1778            config = deps;
     1779            if (isArray(callback)) {
     1780                // Adjust args if there are dependencies
     1781                deps = callback;
     1782                callback = errback;
     1783                errback = optional;
     1784            } else {
     1785                deps = [];
     1786            }
     1787        }
     1788
     1789        if (config && config.context) {
     1790            contextName = config.context;
     1791        }
     1792
     1793        context = getOwn(contexts, contextName);
     1794        if (!context) {
     1795            context = contexts[contextName] = req.s.newContext(contextName);
     1796        }
     1797
     1798        if (config) {
     1799            context.configure(config);
     1800        }
     1801
     1802        return context.require(deps, callback, errback);
     1803    };
     1804
     1805    /**
     1806     * Support formintorjs.require.config() to make it easier to cooperate with other
     1807     * AMD loaders on globally agreed names.
     1808     */
     1809    req.config = function (config) {
     1810        return req(config);
     1811    };
     1812
     1813    /**
     1814     * Execute something after the current tick
     1815     * of the event loop. Override for other envs
     1816     * that have a better solution than setTimeout.
     1817     * @param  {Function} fn function to execute later.
     1818     */
     1819    req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
     1820        setTimeout(fn, 4);
     1821    } : function (fn) { fn(); };
     1822
     1823    /**
     1824     * Export require as a global, but only if it does not already exist.
     1825     */
     1826    if (!require) {
     1827        require = req;
     1828    }
     1829
     1830    req.version = version;
     1831
     1832    //Used to filter out dependencies that are already paths.
     1833    req.jsExtRegExp = /^\/|:|\?|\.js$/;
     1834    req.isBrowser = isBrowser;
     1835    s = req.s = {
     1836        contexts: contexts,
     1837        newContext: newContext
     1838    };
     1839
     1840    //Create default context.
     1841    req({});
     1842
     1843    //Exports some context-sensitive methods on global require.
     1844    each([
     1845        'toUrl',
     1846        'undef',
     1847        'defined',
     1848        'specified'
     1849    ], function (prop) {
     1850        //Reference from contexts instead of early binding to default context,
     1851        //so that during builds, the latest instance of the default context
     1852        //with its config gets used.
     1853        req[prop] = function () {
     1854            var ctx = contexts[defContextName];
     1855            return ctx.require[prop].apply(ctx, arguments);
     1856        };
     1857    });
     1858
     1859    if (isBrowser) {
     1860        head = s.head = document.getElementsByTagName('head')[0];
     1861        //If BASE tag is in play, using appendChild is a problem for IE6.
     1862        //When that browser dies, this can be removed. Details in this jQuery bug:
     1863        //http://dev.jquery.com/ticket/2709
     1864        baseElement = document.getElementsByTagName('base')[0];
     1865        if (baseElement) {
     1866            head = s.head = baseElement.parentNode;
     1867        }
     1868    }
     1869
     1870    /**
     1871     * Any errors that require explicitly generates will be passed to this
     1872     * function. Intercept/override it if you want custom error handling.
     1873     * @param {Error} err the error object.
     1874     */
     1875    req.onError = defaultOnError;
     1876
     1877    /**
     1878     * Creates the node for the load command. Only used in browser envs.
     1879     */
     1880    req.createNode = function (config, moduleName, url) {
     1881        var node = config.xhtml ?
     1882                document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
     1883                document.createElement('script');
     1884        node.type = config.scriptType || 'text/javascript';
     1885        node.charset = 'utf-8';
     1886        node.async = true;
     1887        return node;
     1888    };
     1889
     1890    /**
     1891     * Does the request to load a module for the browser case.
     1892     * Make this a separate function to allow other environments
     1893     * to override it.
     1894     *
     1895     * @param {Object} context the require context to find state.
     1896     * @param {String} moduleName the name of the module.
     1897     * @param {Object} url the URL to the module.
     1898     */
     1899    req.load = function (context, moduleName, url) {
     1900        var config = (context && context.config) || {},
     1901            node;
     1902        if (isBrowser) {
     1903            //In the browser so use a script tag
     1904            node = req.createNode(config, moduleName, url);
     1905
     1906            node.setAttribute('data-requirecontext', context.contextName);
     1907            node.setAttribute('data-requiremodule', moduleName);
     1908
     1909            //Set up load listener. Test attachEvent first because IE9 has
     1910            //a subtle issue in its addEventListener and script onload firings
     1911            //that do not match the behavior of all other browsers with
     1912            //addEventListener support, which fire the onload event for a
     1913            //script right after the script execution. See:
     1914            //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
     1915            //UNFORTUNATELY Opera implements attachEvent but does not follow the script
     1916            //script execution mode.
     1917            if (node.attachEvent &&
     1918                    //Check if node.attachEvent is artificially added by custom script or
     1919                    //natively supported by browser
     1920                    //read https://github.com/requirejs/requirejs/issues/187
     1921                    //if we can NOT find [native code] then it must NOT natively supported.
     1922                    //in IE8, node.attachEvent does not have toString()
     1923                    //Note the test for "[native code" with no closing brace, see:
     1924                    //https://github.com/requirejs/requirejs/issues/273
     1925                    !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
     1926                    !isOpera) {
     1927                //Probably IE. IE (at least 6-8) do not fire
     1928                //script onload right after executing the script, so
     1929                //we cannot tie the anonymous define call to a name.
     1930                //However, IE reports the script as being in 'interactive'
     1931                //readyState at the time of the define call.
     1932                useInteractive = true;
     1933
     1934                node.attachEvent('onreadystatechange', context.onScriptLoad);
     1935                //It would be great to add an error handler here to catch
     1936                //404s in IE9+. However, onreadystatechange will fire before
     1937                //the error handler, so that does not help. If addEventListener
     1938                //is used, then IE will fire error before load, but we cannot
     1939                //use that pathway given the connect.microsoft.com issue
     1940                //mentioned above about not doing the 'script execute,
     1941                //then fire the script load event listener before execute
     1942                //next script' that other browsers do.
     1943                //Best hope: IE10 fixes the issues,
     1944                //and then destroys all installs of IE 6-9.
     1945                //node.attachEvent('onerror', context.onScriptError);
     1946            } else {
     1947                node.addEventListener('load', context.onScriptLoad, false);
     1948                node.addEventListener('error', context.onScriptError, false);
     1949            }
     1950            node.src = url;
     1951
     1952            //Calling onNodeCreated after all properties on the node have been
     1953            //set, but before it is placed in the DOM.
     1954            if (config.onNodeCreated) {
     1955                config.onNodeCreated(node, config, moduleName, url);
     1956            }
     1957
     1958            //For some cache cases in IE 6-8, the script executes before the end
     1959            //of the appendChild execution, so to tie an anonymous define
     1960            //call to the module name (which is stored on the node), hold on
     1961            //to a reference to this node, but clear after the DOM insertion.
     1962            currentlyAddingScript = node;
     1963            if (baseElement) {
     1964                head.insertBefore(node, baseElement);
     1965            } else {
     1966                head.appendChild(node);
     1967            }
     1968            currentlyAddingScript = null;
     1969
     1970            return node;
     1971        } else if (isWebWorker) {
     1972            try {
     1973                //In a web worker, use importScripts. This is not a very
     1974                //efficient use of importScripts, importScripts will block until
     1975                //its script is downloaded and evaluated. However, if web workers
     1976                //are in play, the expectation is that a build has been done so
     1977                //that only one script needs to be loaded anyway. This may need
     1978                //to be reevaluated if other use cases become common.
     1979
     1980                // Post a task to the event loop to work around a bug in WebKit
     1981                // where the worker gets garbage-collected after calling
     1982                // importScripts(): https://webkit.org/b/153317
     1983                setTimeout(function() {}, 0);
     1984                importScripts(url);
     1985
     1986                //Account for anonymous modules
     1987                context.completeLoad(moduleName);
     1988            } catch (e) {
     1989                context.onError(makeError('importscripts',
     1990                                'importScripts failed for ' +
     1991                                    moduleName + ' at ' + url,
     1992                                e,
     1993                                [moduleName]));
     1994            }
     1995        }
     1996    };
     1997
     1998    function getInteractiveScript() {
     1999        if (interactiveScript && interactiveScript.readyState === 'interactive') {
     2000            return interactiveScript;
     2001        }
     2002
     2003        eachReverse(scripts(), function (script) {
     2004            if (script.readyState === 'interactive') {
     2005                return (interactiveScript = script);
     2006            }
     2007        });
     2008        return interactiveScript;
     2009    }
     2010
     2011    //Look for a data-main script attribute, which could also adjust the baseUrl.
     2012    if (isBrowser && !cfg.skipDataMain) {
     2013        //Figure out baseUrl. Get it from the script tag with require.js in it.
     2014        eachReverse(scripts(), function (script) {
     2015            //Set the 'head' where we can append children by
     2016            //using the script's parent.
     2017            if (!head) {
     2018                head = script.parentNode;
     2019            }
     2020
     2021            //Look for a data-main attribute to set main script for the page
     2022            //to load. If it is there, the path to data main becomes the
     2023            //baseUrl, if it is not already set.
     2024            dataMain = script.getAttribute('data-main');
     2025            if (dataMain) {
     2026                //Preserve dataMain in case it is a path (i.e. contains '?')
     2027                mainScript = dataMain;
     2028
     2029                //Set final baseUrl if there is not already an explicit one,
     2030                //but only do so if the data-main value is not a loader plugin
     2031                //module ID.
     2032                if (!cfg.baseUrl && mainScript.indexOf('!') === -1) {
     2033                    //Pull off the directory of data-main for use as the
     2034                    //baseUrl.
     2035                    src = mainScript.split('/');
     2036                    mainScript = src.pop();
     2037                    subPath = src.length ? src.join('/')  + '/' : './';
     2038
     2039                    cfg.baseUrl = subPath;
     2040                }
     2041
     2042                //Strip off any trailing .js since mainScript is now
     2043                //like a module name.
     2044                mainScript = mainScript.replace(jsSuffixRegExp, '');
     2045
     2046                //If mainScript is still a path, fall back to dataMain
     2047                if (req.jsExtRegExp.test(mainScript)) {
     2048                    mainScript = dataMain;
     2049                }
     2050
     2051                //Put the data-main script in the files to load.
     2052                cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];
     2053
     2054                return true;
     2055            }
     2056        });
     2057    }
     2058
     2059    /**
     2060     * The function that handles definitions of modules. Differs from
     2061     * require() in that a string for the module should be the first argument,
     2062     * and the function to execute after dependencies are loaded should
     2063     * return a value to define the module corresponding to the first argument's
     2064     * name.
     2065     */
     2066    define = function (name, deps, callback) {
     2067        var node, context;
     2068
     2069        //Allow for anonymous modules
     2070        if (typeof name !== 'string') {
     2071            //Adjust args appropriately
     2072            callback = deps;
     2073            deps = name;
     2074            name = null;
     2075        }
     2076
     2077        //This module may not have dependencies
     2078        if (!isArray(deps)) {
     2079            callback = deps;
     2080            deps = null;
     2081        }
     2082
     2083        //If no name, and callback is a function, then figure out if it a
     2084        //CommonJS thing with dependencies.
     2085        if (!deps && isFunction(callback)) {
     2086            deps = [];
     2087            //Remove comments from the callback string,
     2088            //look for require calls, and pull them into the dependencies,
     2089            //but only if there are function args.
     2090            if (callback.length) {
     2091                callback
     2092                    .toString()
     2093                    .replace(commentRegExp, commentReplace)
     2094                    .replace(cjsRequireRegExp, function (match, dep) {
     2095                        deps.push(dep);
     2096                    });
     2097
     2098                //May be a CommonJS thing even without require calls, but still
     2099                //could use exports, and module. Avoid doing exports and module
     2100                //work though if it just needs require.
     2101                //REQUIRES the function to expect the CommonJS variables in the
     2102                //order listed below.
     2103                deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
     2104            }
     2105        }
     2106
     2107        //If in IE 6-8 and hit an anonymous define() call, do the interactive
     2108        //work.
     2109        if (useInteractive) {
     2110            node = currentlyAddingScript || getInteractiveScript();
     2111            if (node) {
     2112                if (!name) {
     2113                    name = node.getAttribute('data-requiremodule');
     2114                }
     2115                context = contexts[node.getAttribute('data-requirecontext')];
     2116            }
     2117        }
     2118
     2119        //Always save off evaluating the def call until the script onload handler.
     2120        //This allows multiple modules to be in a file without prematurely
     2121        //tracing dependencies, and allows for anonymous module support,
     2122        //where the module name is not known until the script onload event
     2123        //occurs. If no context, use the global queue, and get it processed
     2124        //in the onscript load callback.
     2125        if (context) {
     2126            context.defQueue.push([name, deps, callback]);
     2127            context.defQueueMap[name] = true;
     2128        } else {
     2129            globalDefQueue.push([name, deps, callback]);
     2130        }
     2131    };
     2132
     2133    define.amd = {
     2134        jQuery: true
     2135    };
     2136
     2137    /**
     2138     * Executes the text. Normally just uses eval, but can be modified
     2139     * to use a better, environment-specific call. Only used for transpiling
     2140     * loader plugins, not for plain JS modules.
     2141     * @param {String} text the text to execute/evaluate.
     2142     */
     2143    req.exec = function (text) {
     2144        /*jslint evil: true */
     2145        return eval(text);
     2146    };
     2147
     2148    //Set up with config info.
     2149    req(cfg);
     2150}(this, (typeof setTimeout === 'undefined' ? undefined : setTimeout)));
     2151formintorjs.requirejs = requirejs;formintorjs.require = require;formintorjs.define = define;
     2152}
     2153}());
     2154formintorjs.define("requireLib", function(){});
    52155
    62156/**
     
    92159 * see: http://github.com/requirejs/text for details
    102160 */
    11 
    12 var formintorjs;!function(){if(!formintorjs||!formintorjs.requirejs){formintorjs?require=formintorjs:formintorjs={};var requirejs,require,define;!function(global,setTimeout){function commentReplace(t,n){return n||""}function isFunction(t){return"[object Function]"===ostring.call(t)}function isArray(t){return"[object Array]"===ostring.call(t)}function each(t,n){if(t){var e;for(e=0;e<t.length&&(!t[e]||!n(t[e],e,t));e+=1);}}function eachReverse(t,n){if(t){var e;for(e=t.length-1;e>-1&&(!t[e]||!n(t[e],e,t));e-=1);}}function hasProp(t,n){return hasOwn.call(t,n)}function getOwn(t,n){return hasProp(t,n)&&t[n]}function eachProp(t,n){var e;for(e in t)if(hasProp(t,e)&&n(t[e],e))break}function mixin(t,n,e,i){return n&&eachProp(n,function(n,o){!e&&hasProp(t,o)||(!i||"object"!=typeof n||!n||isArray(n)||isFunction(n)||n instanceof RegExp?t[o]=n:(t[o]||(t[o]={}),mixin(t[o],n,e,i)))}),t}function bind(t,n){return function(){return n.apply(t,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(t){throw t}function getGlobal(t){if(!t)return t;var n=global;return each(t.split("."),function(t){n=n[t]}),n}function makeError(t,n,e,i){var o=new Error(n+"\nhttp://requirejs.org/docs/errors.html#"+t);return o.requireType=t,o.requireModules=i,e&&(o.originalError=e),o}function newContext(t){function n(t){var n,e;for(n=0;n<t.length;n++)if("."===(e=t[n]))t.splice(n,1),n-=1;else if(".."===e){if(0===n||1===n&&".."===t[2]||".."===t[n-1])continue;n>0&&(t.splice(n-1,2),n-=2)}}function e(t,e,i){var o,a,r,s,l,p,d,c,u,m,f,h=e&&e.split("/"),_=F.map,v=_&&_["*"];if(t&&(t=t.split("/"),p=t.length-1,F.nodeIdCompat&&jsSuffixRegExp.test(t[p])&&(t[p]=t[p].replace(jsSuffixRegExp,"")),"."===t[0].charAt(0)&&h&&(f=h.slice(0,h.length-1),t=f.concat(t)),n(t),t=t.join("/")),i&&_&&(h||v)){a=t.split("/");t:for(r=a.length;r>0;r-=1){if(l=a.slice(0,r).join("/"),h)for(s=h.length;s>0;s-=1)if((o=getOwn(_,h.slice(0,s).join("/")))&&(o=getOwn(o,l))){d=o,c=r;break t}!u&&v&&getOwn(v,l)&&(u=getOwn(v,l),m=r)}!d&&u&&(d=u,c=m),d&&(a.splice(0,c,d),t=a.join("/"))}return getOwn(F.pkgs,t)||t}function i(t){isBrowser&&each(scripts(),function(n){if(n.getAttribute("data-requiremodule")===t&&n.getAttribute("data-requirecontext")===x.contextName)return n.parentNode.removeChild(n),!0})}function o(t){var n=getOwn(F.paths,t);if(n&&isArray(n)&&n.length>1)return n.shift(),x.require.undef(t),x.makeRequire(null,{skipMap:!0})([t]),!0}function a(t){var n,e=t?t.indexOf("!"):-1;return e>-1&&(n=t.substring(0,e),t=t.substring(e+1,t.length)),[n,t]}function r(t,n,i,o){var r,s,l,p,d=null,c=n?n.name:null,u=t,m=!0,f="";return t||(m=!1,t="_@r"+(T+=1)),p=a(t),d=p[0],t=p[1],d&&(d=e(d,c,o),s=getOwn(U,d)),t&&(d?f=i?t:s&&s.normalize?s.normalize(t,function(t){return e(t,c,o)}):-1===t.indexOf("!")?e(t,c,o):t:(f=e(t,c,o),p=a(f),d=p[0],f=p[1],i=!0,r=x.nameToUrl(f))),l=!d||s||i?"":"_unnormalized"+(S+=1),{prefix:d,name:f,parentMap:n,unnormalized:!!l,url:r,originalName:u,isDefine:m,id:(d?d+"!"+f:f)+l}}function s(t){var n=t.id,e=getOwn(k,n);return e||(e=k[n]=new x.Module(t)),e}function l(t,n,e){var i=t.id,o=getOwn(k,i);!hasProp(U,i)||o&&!o.defineEmitComplete?(o=s(t),o.error&&"error"===n?e(o.error):o.on(n,e)):"defined"===n&&e(U[i])}function p(t,n){var e=t.requireModules,i=!1;n?n(t):(each(e,function(n){var e=getOwn(k,n);e&&(e.error=t,e.events.error&&(i=!0,e.emit("error",t)))}),i||req.onError(t))}function d(){globalDefQueue.length&&(each(globalDefQueue,function(t){var n=t[0];"string"==typeof n&&(x.defQueueMap[n]=!0),$.push(t)}),globalDefQueue=[])}function c(t){delete k[t],delete z[t]}function u(t,n,e){var i=t.map.id;t.error?t.emit("error",t.error):(n[i]=!0,each(t.depMaps,function(i,o){var a=i.id,r=getOwn(k,a);!r||t.depMatched[o]||e[a]||(getOwn(n,a)?(t.defineDep(o,U[a]),t.check()):u(r,n,e))}),e[i]=!0)}function m(){var t,n,e=1e3*F.waitSeconds,a=e&&x.startTime+e<(new Date).getTime(),r=[],s=[],l=!1,d=!0;if(!b){if(b=!0,eachProp(z,function(t){var e=t.map,p=e.id;if(t.enabled&&(e.isDefine||s.push(t),!t.error))if(!t.inited&&a)o(p)?(n=!0,l=!0):(r.push(p),i(p));else if(!t.inited&&t.fetched&&e.isDefine&&(l=!0,!e.prefix))return d=!1}),a&&r.length)return t=makeError("timeout","Load timeout for modules: "+r,null,r),t.contextName=x.contextName,p(t);d&&each(s,function(t){u(t,{},{})}),a&&!n||!l||!isBrowser&&!isWebWorker||w||(w=setTimeout(function(){w=0,m()},50)),b=!1}}function f(t){hasProp(U,t[0])||s(r(t[0],null,!0)).init(t[1],t[2])}function h(t,n,e,i){t.detachEvent&&!isOpera?i&&t.detachEvent(i,n):t.removeEventListener(e,n,!1)}function _(t){var n=t.currentTarget||t.srcElement;return h(n,x.onScriptLoad,"load","onreadystatechange"),h(n,x.onScriptError,"error"),{node:n,id:n&&n.getAttribute("data-requiremodule")}}function v(){var t;for(d();$.length;){if(t=$.shift(),null===t[0])return p(makeError("mismatch","Mismatched anonymous define() module: "+t[t.length-1]));f(t)}x.defQueueMap={}}var b,g,x,y,w,F={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},k={},z={},q={},$=[],U={},j={},C={},T=1,S=1;return y={require:function(t){return t.require?t.require:t.require=x.makeRequire(t.map)},exports:function(t){if(t.usingExports=!0,t.map.isDefine)return t.exports?U[t.map.id]=t.exports:t.exports=U[t.map.id]={}},module:function(t){return t.module?t.module:t.module={id:t.map.id,uri:t.map.url,config:function(){return getOwn(F.config,t.map.id)||{}},exports:t.exports||(t.exports={})}}},g=function(t){this.events=getOwn(q,t.id)||{},this.map=t,this.shim=getOwn(F.shim,t.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},g.prototype={init:function(t,n,e,i){i=i||{},this.inited||(this.factory=n,e?this.on("error",e):this.events.error&&(e=bind(this,function(t){this.emit("error",t)})),this.depMaps=t&&t.slice(0),this.errback=e,this.inited=!0,this.ignore=i.ignore,i.enabled||this.enabled?this.enable():this.check())},defineDep:function(t,n){this.depMatched[t]||(this.depMatched[t]=!0,this.depCount-=1,this.depExports[t]=n)},fetch:function(){if(!this.fetched){this.fetched=!0,x.startTime=(new Date).getTime();var t=this.map;if(!this.shim)return t.prefix?this.callPlugin():this.load();x.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return t.prefix?this.callPlugin():this.load()}))}},load:function(){var t=this.map.url;j[t]||(j[t]=!0,x.load(this.map.id,t))},check:function(){if(this.enabled&&!this.enabling){var t,n,e=this.map.id,i=this.depExports,o=this.exports,a=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(a)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{o=x.execCb(e,a,i,o)}catch(n){t=n}else o=x.execCb(e,a,i,o);if(this.map.isDefine&&void 0===o&&(n=this.module,n?o=n.exports:this.usingExports&&(o=this.exports)),t)return t.requireMap=this.map,t.requireModules=this.map.isDefine?[this.map.id]:null,t.requireType=this.map.isDefine?"define":"require",p(this.error=t)}else o=a;if(this.exports=o,this.map.isDefine&&!this.ignore&&(U[e]=o,req.onResourceLoad)){var r=[];each(this.depMaps,function(t){r.push(t.normalizedMap||t)}),req.onResourceLoad(x,this.map,r)}c(e),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(x.defQueueMap,e)||this.fetch()}},callPlugin:function(){var t=this.map,n=t.id,i=r(t.prefix);this.depMaps.push(i),l(i,"defined",bind(this,function(i){var o,a,d,u=getOwn(C,this.map.id),m=this.map.name,f=this.map.parentMap?this.map.parentMap.name:null,h=x.makeRequire(t.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(i.normalize&&(m=i.normalize(m,function(t){return e(t,f,!0)})||""),a=r(t.prefix+"!"+m,this.map.parentMap,!0),l(a,"defined",bind(this,function(t){this.map.normalizedMap=a,this.init([],function(){return t},null,{enabled:!0,ignore:!0})})),void((d=getOwn(k,a.id))&&(this.depMaps.push(a),this.events.error&&d.on("error",bind(this,function(t){this.emit("error",t)})),d.enable()))):u?(this.map.url=x.nameToUrl(u),void this.load()):(o=bind(this,function(t){this.init([],function(){return t},null,{enabled:!0})}),o.error=bind(this,function(t){this.inited=!0,this.error=t,t.requireModules=[n],eachProp(k,function(t){0===t.map.id.indexOf(n+"_unnormalized")&&c(t.map.id)}),p(t)}),o.fromText=bind(this,function(e,i){var a=t.name,l=r(a),d=useInteractive;i&&(e=i),d&&(useInteractive=!1),s(l),hasProp(F.config,n)&&(F.config[a]=F.config[n]);try{req.exec(e)}catch(t){return p(makeError("fromtexteval","fromText eval for "+n+" failed: "+t,t,[n]))}d&&(useInteractive=!0),this.depMaps.push(l),x.completeLoad(a),h([a],o)}),void i.load(t.name,h,o,F))})),x.enable(i,this),this.pluginMaps[i.id]=i},enable:function(){z[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(t,n){var e,i,o;if("string"==typeof t){if(t=r(t,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[n]=t,o=getOwn(y,t.id))return void(this.depExports[n]=o(this));this.depCount+=1,l(t,"defined",bind(this,function(t){this.undefed||(this.defineDep(n,t),this.check())})),this.errback?l(t,"error",bind(this,this.errback)):this.events.error&&l(t,"error",bind(this,function(t){this.emit("error",t)}))}e=t.id,i=k[e],hasProp(y,e)||!i||i.enabled||x.enable(t,this)})),eachProp(this.pluginMaps,bind(this,function(t){var n=getOwn(k,t.id);n&&!n.enabled&&x.enable(t,this)})),this.enabling=!1,this.check()},on:function(t,n){var e=this.events[t];e||(e=this.events[t]=[]),e.push(n)},emit:function(t,n){each(this.events[t],function(t){t(n)}),"error"===t&&delete this.events[t]}},x={config:F,contextName:t,registry:k,defined:U,urlFetched:j,defQueue:$,defQueueMap:{},Module:g,makeModuleMap:r,nextTick:req.nextTick,onError:p,configure:function(t){if(t.baseUrl&&"/"!==t.baseUrl.charAt(t.baseUrl.length-1)&&(t.baseUrl+="/"),"string"==typeof t.urlArgs){var n=t.urlArgs;t.urlArgs=function(t,e){return(-1===e.indexOf("?")?"?":"&")+n}}var e=F.shim,i={paths:!0,bundles:!0,config:!0,map:!0};eachProp(t,function(t,n){i[n]?(F[n]||(F[n]={}),mixin(F[n],t,!0,!0)):F[n]=t}),t.bundles&&eachProp(t.bundles,function(t,n){each(t,function(t){t!==n&&(C[t]=n)})}),t.shim&&(eachProp(t.shim,function(t,n){isArray(t)&&(t={deps:t}),!t.exports&&!t.init||t.exportsFn||(t.exportsFn=x.makeShimExports(t)),e[n]=t}),F.shim=e),t.packages&&each(t.packages,function(t){var n,e;t="string"==typeof t?{name:t}:t,e=t.name,n=t.location,n&&(F.paths[e]=t.location),F.pkgs[e]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(k,function(t,n){t.inited||t.map.unnormalized||(t.map=r(n,null,!0))}),(t.deps||t.callback)&&x.require(t.deps||[],t.callback)},makeShimExports:function(t){function n(){var n;return t.init&&(n=t.init.apply(global,arguments)),n||t.exports&&getGlobal(t.exports)}return n},makeRequire:function(n,o){function a(e,i,l){var d,c,u;return o.enableBuildCallback&&i&&isFunction(i)&&(i.__requireJsBuild=!0),"string"==typeof e?isFunction(i)?p(makeError("requireargs","Invalid require call"),l):n&&hasProp(y,e)?y[e](k[n.id]):req.get?req.get(x,e,n,a):(c=r(e,n,!1,!0),d=c.id,hasProp(U,d)?U[d]:p(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+t+(n?"":". Use require([])")))):(v(),x.nextTick(function(){v(),u=s(r(null,n)),u.skipMap=o.skipMap,u.init(e,i,l,{enabled:!0}),m()}),a)}return o=o||{},mixin(a,{isBrowser:isBrowser,toUrl:function(t){var i,o=t.lastIndexOf("."),a=t.split("/")[0],r="."===a||".."===a;return-1!==o&&(!r||o>1)&&(i=t.substring(o,t.length),t=t.substring(0,o)),x.nameToUrl(e(t,n&&n.id,!0),i,!0)},defined:function(t){return hasProp(U,r(t,n,!1,!0).id)},specified:function(t){return t=r(t,n,!1,!0).id,hasProp(U,t)||hasProp(k,t)}}),n||(a.undef=function(t){d();var e=r(t,n,!0),o=getOwn(k,t);o.undefed=!0,i(t),delete U[t],delete j[e.url],delete q[t],eachReverse($,function(n,e){n[0]===t&&$.splice(e,1)}),delete x.defQueueMap[t],o&&(o.events.defined&&(q[t]=o.events),c(t))}),a},enable:function(t){getOwn(k,t.id)&&s(t).enable()},completeLoad:function(t){var n,e,i,a=getOwn(F.shim,t)||{},r=a.exports;for(d();$.length;){if(e=$.shift(),null===e[0]){if(e[0]=t,n)break;n=!0}else e[0]===t&&(n=!0);f(e)}if(x.defQueueMap={},i=getOwn(k,t),!n&&!hasProp(U,t)&&i&&!i.inited){if(!(!F.enforceDefine||r&&getGlobal(r)))return o(t)?void 0:p(makeError("nodefine","No define call for "+t,null,[t]));f([t,a.deps||[],a.exportsFn])}m()},nameToUrl:function(t,n,e){var i,o,a,r,s,l,p,d=getOwn(F.pkgs,t);if(d&&(t=d),p=getOwn(C,t))return x.nameToUrl(p,n,e);if(req.jsExtRegExp.test(t))s=t+(n||"");else{for(i=F.paths,o=t.split("/"),a=o.length;a>0;a-=1)if(r=o.slice(0,a).join("/"),l=getOwn(i,r)){isArray(l)&&(l=l[0]),o.splice(0,a,l);break}s=o.join("/"),s+=n||(/^data\:|^blob\:|\?/.test(s)||e?"":".js"),s=("/"===s.charAt(0)||s.match(/^[\w\+\.\-]+:/)?"":F.baseUrl)+s}return F.urlArgs&&!/^blob\:/.test(s)?s+F.urlArgs(t,s):s},load:function(t,n){req.load(x,t,n)},execCb:function(t,n,e,i){return n.apply(i,e)},onScriptLoad:function(t){if("load"===t.type||readyRegExp.test((t.currentTarget||t.srcElement).readyState)){interactiveScript=null;var n=_(t);x.completeLoad(n.id)}},onScriptError:function(t){var n=_(t);if(!o(n.id)){var e=[];return eachProp(k,function(t,i){0!==i.indexOf("_@r")&&each(t.depMaps,function(t){if(t.id===n.id)return e.push(i),!0})}),p(makeError("scripterror",'Script error for "'+n.id+(e.length?'", needed by: '+e.join(", "):'"'),t,[n.id]))}}},x.require=x.makeRequire(),x}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(t){if("interactive"===t.readyState)return interactiveScript=t}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.3",commentRegExp=/\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if(void 0===define){if(void 0!==requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}void 0===require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(t,n,e,i){var o,a,r=defContextName;return isArray(t)||"string"==typeof t||(a=t,isArray(n)?(t=n,n=e,e=i):t=[]),a&&a.context&&(r=a.context),o=getOwn(contexts,r),o||(o=contexts[r]=req.s.newContext(r)),a&&o.configure(a),o.require(t,n,e)},req.config=function(t){return req(t)},req.nextTick=void 0!==setTimeout?function(t){setTimeout(t,4)}:function(t){t()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(t){req[t]=function(){var n=contexts[defContextName];return n.require[t].apply(n,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],(baseElement=document.getElementsByTagName("base")[0])&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(t,n,e){var i=t.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return i.type=t.scriptType||"text/javascript",i.charset="utf-8",i.async=!0,i},req.load=function(t,n,e){var i,o=t&&t.config||{};if(isBrowser)return i=req.createNode(o,n,e),i.setAttribute("data-requirecontext",t.contextName),i.setAttribute("data-requiremodule",n),!i.attachEvent||i.attachEvent.toString&&i.attachEvent.toString().indexOf("[native code")<0||isOpera?(i.addEventListener("load",t.onScriptLoad,!1),i.addEventListener("error",t.onScriptError,!1)):(useInteractive=!0,i.attachEvent("onreadystatechange",t.onScriptLoad)),i.src=e,o.onNodeCreated&&o.onNodeCreated(i,o,n,e),currentlyAddingScript=i,baseElement?head.insertBefore(i,baseElement):head.appendChild(i),currentlyAddingScript=null,i;if(isWebWorker)try{setTimeout(function(){},0),importScripts(e),t.completeLoad(n)}catch(i){t.onError(makeError("importscripts","importScripts failed for "+n+" at "+e,i,[n]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(t){if(head||(head=t.parentNode),dataMain=t.getAttribute("data-main"))return mainScript=dataMain,cfg.baseUrl||-1!==mainScript.indexOf("!")||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(t,n,e){var i,o;"string"!=typeof t&&(e=n,n=t,t=null),isArray(n)||(e=n,n=null),!n&&isFunction(e)&&(n=[],e.length&&(e.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(t,e){n.push(e)}),n=(1===e.length?["require"]:["require","exports","module"]).concat(n))),useInteractive&&(i=currentlyAddingScript||getInteractiveScript())&&(t||(t=i.getAttribute("data-requiremodule")),o=contexts[i.getAttribute("data-requirecontext")]),o?(o.defQueue.push([t,n,e]),o.defQueueMap[t]=!0):globalDefQueue.push([t,n,e])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}}(this,"undefined"==typeof setTimeout?void 0:setTimeout),formintorjs.requirejs=requirejs,formintorjs.require=require,formintorjs.define=define}}(),formintorjs.define("requireLib",function(){}),formintorjs.define("text",["module"],function(t){"use strict";var n,e,i=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],o=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,a=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,r="undefined"!=typeof location&&location.href,s=r&&location.protocol&&location.protocol.replace(/\:/,""),l=r&&location.hostname,p=r&&(location.port||void 0),d=[],c=t.config&&t.config()||{};return n={version:"2.0.3",strip:function(t){if(t){t=t.replace(o,"");var n=t.match(a);n&&(t=n[1])}else t="";return t},jsEscape:function(t){return t.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:c.createXhr||function(){var t,n,e;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(n=0;n<3;n+=1){e=i[n];try{t=new ActiveXObject(e)}catch(t){}if(t){i=[e];break}}return t},parseName:function(t){var n=!1,e=t.indexOf("."),i=t.substring(0,e),o=t.substring(e+1,t.length);return e=o.indexOf("!"),-1!==e&&(n=o.substring(e+1,o.length),n="strip"===n,o=o.substring(0,e)),{moduleName:i,ext:o,strip:n}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(t,e,i,o){var a,r,s,l=n.xdRegExp.exec(t);return!l||(a=l[2],r=l[3],r=r.split(":"),s=r[1],r=r[0],!(a&&a!==e||r&&r.toLowerCase()!==i.toLowerCase()||(s||r)&&s!==o))},finishLoad:function(t,e,i,o){i=e?n.strip(i):i,c.isBuild&&(d[t]=i),o(i)},load:function(t,e,i,o){if(o.isBuild&&!o.inlineText)return void i();c.isBuild=o.isBuild;var a=n.parseName(t),d=a.moduleName+"."+a.ext,u=e.toUrl(d),m=c.useXhr||n.useXhr;!r||m(u,s,l,p)?n.get(u,function(e){n.finishLoad(t,a.strip,e,i)},function(t){i.error&&i.error(t)}):e([d],function(t){n.finishLoad(a.moduleName+"."+a.ext,a.strip,t,i)})},write:function(t,e,i,o){if(d.hasOwnProperty(e)){var a=n.jsEscape(d[e]);i.asModule(t+"!"+e,"define(function () { return '"+a+"';});\n")}},writeFile:function(t,e,i,o,a){var r=n.parseName(e),s=r.moduleName+"."+r.ext,l=i.toUrl(r.moduleName+"."+r.ext)+".js";n.load(s,i,function(e){var i=function(t){return o(l,t)};i.asModule=function(t,n){return o.asModule(t,l,n)},n.write(t,s,i,a)},a)}},"node"===c.env||!c.env&&"undefined"!=typeof process&&process.versions&&process.versions.node?(e=require.nodeRequire("fs"),n.get=function(t,n){var i=e.readFileSync(t,"utf8");0===i.indexOf("\ufeff")&&(i=i.substring(1)),n(i)}):"xhr"===c.env||!c.env&&n.createXhr()?n.get=function(t,e,i){var o=n.createXhr();o.open("GET",t,!0),c.onXhr&&c.onXhr(o,t),o.onreadystatechange=function(n){var a,r;4===o.readyState&&(a=o.status,a>399&&a<600?(r=new Error(t+" HTTP status: "+a),r.xhr=o,i(r)):e(o.responseText))},o.send(null)}:("rhino"===c.env||!c.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java)&&(n.get=function(t,n){var e,i,o=new java.io.File(t),a=java.lang.System.getProperty("line.separator"),r=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(o),"utf-8")),s="";try{for(e=new java.lang.StringBuffer,i=r.readLine(),i&&i.length()&&65279===i.charAt(0)&&(i=i.substring(1)),e.append(i);null!==(i=r.readLine());)e.append(a),e.append(i);s=String(e.toString())}finally{r.close()}n(s)}),n}),formintorjs.define("text!admin/templates/popups.html",[],function(){return'<div>\r\n\r\n\t\x3c!-- Base Structure --\x3e\r\n\t<script type="text/template" id="popup-tpl">\r\n\r\n\t\t<div class="sui-modal">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-popup__title"\r\n\t\t\t\taria-describedby="forminator-popup__description"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- Modal Header: Center-aligned title with floating close button --\x3e\r\n\t<script type="text/template" id="popup-header-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ title }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- Modal Header: Inline title and close button --\x3e\r\n\t<script type="text/template" id="popup-header-inline-tpl">\r\n\r\n\t\t<div class="sui-box-header">\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title">{{ title }}</h3>\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button-icon forminator-popup-close" data-modal-close>\r\n\t\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-integration-tpl">\r\n\r\n\t\t<div class="sui-modal sui-modal-sm">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-integration-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-integration-popup__title"\r\n\t\t\t\taria-describedby="forminator-integration-popup__description"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-integration-content-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<figure class="sui-box-logo" aria-hidden="true">\r\n\r\n\t\t\t\t<img\r\n\t\t\t\t\tsrc="{{ image }}"\r\n\t\t\t\t\tsrcset="{{ image }} 1x, {{ image_x2 }} 2x"\r\n\t\t\t\t\talt="{{ title }}"\r\n\t\t\t\t/>\r\n\r\n\t\t\t</figure>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--left forminator-addon-back" style="display: none;">\r\n\t\t\t\t<span class="sui-icon-chevron-left sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Back</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-integration-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<div class="forminator-integration-popup__header"></div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="forminator-integration-popup__body sui-box-body"></div>\r\n\r\n\t\t<div class="forminator-integration-popup__footer sui-box-footer sui-flatten sui-content-separated"></div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-loader-tpl">\r\n\r\n\t\t<p style="margin: 0; text-align: center;" aria-hidden="true"><span class="sui-icon-loader sui-md sui-loading"></span></p>\r\n\t\t<p class="sui-screen-reader-text">Loading content...</p>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-stripe-tpl">\r\n\r\n\t\t<div class="sui-modal sui-modal-md">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-stripe-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-stripe-popup__title"\r\n\t\t\t\taria-describedby=""\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-stripe-content-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<figure class="sui-box-logo" aria-hidden="true">\r\n\t\t\t\t<img src="{{ image }}" srcset="{{ image }} 1x, {{ image_x2 }} 2x" alt="{{ title }}" />\r\n\t\t\t</figure>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close">\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-stripe-popup__title" class="sui-box-title sui-lg" style="overflow: initial; display: none; white-space: normal; text-overflow: initial;">{{ title }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10"></div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center"></div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-slide-tpl">\r\n\t\t<div class="sui-modal sui-modal-lg">\r\n\t\t\t<div\r\n\t\t\t\t\trole="dialog"\r\n\t\t\t\t\tid="forminator-popup"\r\n\t\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\t\taria-modal="true"\r\n\t\t\t\t\taria-labelledby="forminator-slide-popup__title"\r\n\t\t\t\t\taria-describedby="forminator-slide-popup__description"\r\n\t\t\t>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t<\/script>\r\n\r\n</div>\r\n'}),function(t){window.empty=function(t){return void 0===t||!t},window.count=function(t){return void 0===t?0:t&&t.length?t.length:0},window.stripslashes=function(t){return(t+"").replace(/\\(.?)/g,function(t,n){switch(n){case"\\":return"\\";case"0":return"\0";case"":return"";default:return n}})},window.forminator_array_value_exists=function(t,n){return!_.isUndefined(t[n])&&!_.isEmpty(t[n])},window.decodeHtmlEntity=function(t){return void 0===t?t:t.replace(/&#(\d+);/g,function(t,n){return String.fromCharCode(n)})},window.encodeHtmlEntity=function(t){if(void 0===t)return t;for(var n=[],e=t.length-1;e>=0;e--)n.unshift(["&#",t[e].charCodeAt(),";"].join(""));return n.join("")},window.singularPluralText=function(t,n,e){var i="";return i=t<2?n:e,t+" "+i},window.isTrue=function(t){if(void 0===t)return!1;switch("string"==typeof t&&(t=t.trim().toLowerCase()),t){case!0:case"true":case 1:case"1":case"on":case"yes":return!0;default:return!1}},formintorjs.define("admin/utils",["text!admin/templates/popups.html"],function(n){var e={fields_ids:[],google_font_families:[],is_touch:function(){return Forminator.Data.is_touch},is_mobile_size:function(){return window.screen.width<=782},is_mobile:function(){return!(!Forminator.Utils.is_touch()&&!Forminator.Utils.is_mobile_size())},template:function(t){return _.templateSettings={evaluate:/\{\[([\s\S]+?)\]\}/g,interpolate:/\{\{([\s\S]+?)\}\}/g},_.template(t)},template_php:function(t){var n=_.templateSettings,e=!1;return _.templateSettings={interpolate:/<\?php echo (.+?) \?>/g,evaluate:/<\?php (.+?) \?>/g},e=_.template(t),_.templateSettings=n,function(t){return _.each(t,function(n,e){t["$"+e]=n}),e(t)}},ucfirst:function(t){return t.charAt(0).toUpperCase()+t.slice(1)},get_slug:function(t){return t=t.replace(" ","-"),t=t.replace(/[^-a-zA-Z0-9]/,"")},sanitize_uri_string:function(t){var n=decodeURIComponent(t);return n=n.replace(/-/g," ")},sanitize_text_field:function(t){if(!_.isUndefined(t)){return String(t).replace(/[&\/\\#^+()$~%.'":*?<>{}!@]/g,"").trim()}return t},get_url_param:function(t){for(var n=window.location.search.substring(1),e=n.split("&"),i=0;i<e.length;i++){var o=e[i].split("=");if(o[0]===t)return o[1]}return!1},is_email_wp:function(t){if(t.length<6)return!1;if(t.indexOf("@",1)<0)return!1;var n=t.split("@",2);if(!n[0].match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~\.-]+$/))return!1;if(n[1].match(/\.{2,}/))return!1;var e=n[1],i=e.split(".");if(i.length<2)return!1;for(var o=i.length,a=0;a<o;a++)if(!i[a].match(/^[a-z0-9-]+$/i))return!1;return!0},forminator_select2_tags:function(n,e){n.find("select.sui-select.fui-multi-select").each(function(){var n=t(this),i=n.closest(".sui-modal-content"),o=i.attr("id"),a=t(i.length?"#"+o:"SUI_BODY_CLASS"),r="true"===n.attr("data-search")?0:-1,s=n.hasClass("sui-select-sm")?"sui-select-dropdown-sm":"";e=_.defaults(e,{dropdownParent:a,minimumResultsForSearch:r,dropdownCssClass:s}),n.attr("data-reorder")&&n.on("select2:select",function(e){var i=e.params.data.element,o=t(i),a=n;a.append(o),a.trigger("change.select2")}),n.SUIselect2(e)})},forminator_select2_custom:function(n,e){n.find("select.sui-select.custom-select2").each(function(){var n=t(this),i=n.closest(".sui-modal-content"),o=i.attr("id"),a=t(i.length?"#"+o:"body"),r="true"===n.attr("data-search")?0:-1,s=n.hasClass("sui-select-sm")?"sui-select-dropdown-sm":"";e=_.defaults(e,{dropdownParent:a,minimumResultsForSearch:r,dropdownCssClass:s}),n.attr("data-reorder")&&n.on("select2:select",function(n){var e=n.params.data.element,i=t(e),o=t(this);o.append(i),o.trigger("change.select2")}),n.SUIselect2(e)})},init_select2:function(){window.SUI},load_google_fonts:function(n){var e=this;t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_load_google_fonts",_wpnonce:Forminator.Data.gFontNonce}}).done(function(t){!0===t.success&&(e.google_font_families=t.data),n.apply(t,[e.google_font_families])})},sui_delegate_events:function(){"object"==typeof window.SUI&&setTimeout(function(){SUI.suiAccordion(t(".sui-accordion")),SUI.suiTabs(t(".sui-tabs")),t('select.sui-select[data-theme="icon"]').each(function(){SUI.select.initIcon(t(this))}),t('select.sui-select[data-theme="color"]').each(function(){SUI.select.initColor(t(this))}),t('select.sui-select[data-theme="search"]').each(function(){SUI.select.initSearch(t(this))}),t("select.sui-select:not([data-theme]):not(.custom-select2):not(.fui-multi-select)").each(function(){SUI.select.init(t(this))}),t("select.sui-variables").each(function(){SUI.select.initVars(t(this))}),SUI.loadCircleScore(t(".sui-circle-score")),SUI.showHidePassword()},50)}},i={$popup:{},_deferred:{},initialize:function(){var e=Forminator.Utils.template(t(n).find("#popup-tpl").html());t("#forminator-popup").length?(t("#forminator-popup").remove(),this.initialize()):t("main.sui-wrap").append(e({})),this.$popup=t("#forminator-popup"),this.$popupId="forminator-popup",this.$focusAfterClosed="wpbody-content"},open:function(e,i,o,a){this.data=i,this.title="",this.action_text="",this.action_callback=!1,this.action_css_class="",this.has_custom_box=!1,this.has_footer=!0;var r="";switch(a){case"inline":r=Forminator.Utils.template(t(n).find("#popup-header-inline-tpl").html())
    13 ;break;case"center":r=Forminator.Utils.template(t(n).find("#popup-header-tpl").html())}_.isUndefined(this.data)||(_.isUndefined(this.data.title)||(this.title=Forminator.Utils.sanitize_text_field(this.data.title)),_.isUndefined(this.data.has_footer)||(this.has_footer=this.data.has_footer),_.isUndefined(this.data.action_callback)||_.isUndefined(this.data.action_text)||(this.action_callback=this.data.action_callback,this.action_text=this.data.action_text,_.isUndefined(this.data.action_css_class)||(this.action_css_class=this.data.action_css_class)),_.isUndefined(this.data.has_custom_box)||(this.has_custom_box=this.data.has_custom_box)),this.initialize(),""!==r&&this.$popup.find(".sui-box").html(r({title:this.title}));var s=this,l=function(){return s.close(),!1};if(o&&this.$popup.closest(".sui-modal").addClass("sui-modal-"+o),this.has_custom_box)e.apply(this.$popup.find(".sui-box").get(),i);else{var p='<div class="sui-box-body"></div>';this.has_footer&&(p+='<div class="sui-box-footer"><button class="sui-button forminator-popup-cancel">'+Forminator.l10n.popup.cancel+"</button></div>"),this.$popup.find(".sui-box").append(p),e.apply(this.$popup.find(".sui-box-body").get(),i)}if(this.action_text&&this.action_callback){var d=this.action_callback;this.$popup.find(".sui-box-footer").append('<div class="sui-actions-right"><button class="forminator-popup-action sui-button '+this.action_css_class+'">'+this.action_text+"</button></div>"),this.$popup.find(".forminator-popup-action").on("click",function(){d&&d.apply(),s.close()})}else this.$popup.find(".forminator-popup-action").remove();return this.$popup.find(".forminator-popup-close").on("click",l),this.$popup.find(".forminator-popup-cancel").on("click",l),this.$popup.on("click",".forminator-popup-cancel",l),SUI.openModal(this.$popupId,this.$focusAfterClosed,void 0,!0,!0),Forminator.Utils.sui_delegate_events(),this._deferred=new t.Deferred,this._deferred.promise()},close:function(t,n){var e=this;SUI.closeModal(),setTimeout(function(){e.$popup.closest(".sui-modal").removeClass("sui-modal-sm").removeClass("sui-modal-md").removeClass("sui-modal-lg").removeClass("sui-modal-xl"),n&&n.apply()},300),this._deferred.resolve(this.$popup,t)}},o={$notification:{},_deferred:{},initialize:function(){t(".sui-floating-notices").length?(t(".sui-floating-notices").remove(),this.initialize()):t("main.sui-wrap").prepend('<div class="sui-floating-notices"><div role="alert" id="forminator-floating-notification" class="sui-notice" aria-live="assertive"></div></div>'),this.$notification=t("#forminator-floating-notification")},open:function(n,e,i){var o=this;return _.isUndefined(i)||5e3,this.uniq="forminator-floating-notification",this.text="<p>"+e+"</p>",this.type="",this.time=i||5e3,_.isUndefined(n)||""===n||(this.type=n),_.isUndefined(i)||(this.time=i),this.opts={type:this.type,autoclose:{show:!0,timeout:this.time}},this.initialize(),SUI.openNotice(this.uniq,this.text,this.opts),setTimeout(function(){o.close()},3e3),this._deferred=new t.Deferred,this._deferred.promise()},close:function(t){this._deferred.resolve(this.$popup,t)}};return{Utils:e,Popup:i,Integrations_Popup:{$popup:{},_deferred:{},initialize:function(){var e=Forminator.Utils.template(t(n).find("#popup-integration-tpl").html());t("#forminator-integration-popup").length?(t("#forminator-integration-popup").remove(),this.initialize()):t("main.sui-wrap").append(e({provider_image:"",provider_image2:"",provider_title:""})),this.$popup=t("#forminator-integration-popup"),this.$popupId="forminator-integration-popup",this.$focusAfterClosed="forminator-integrations-page"},open:function(e,i,o){this.data=i,this.title="",this.image="",this.image_x2="",this.action_text="",this.action_callback=!1,this.action_css_class="",this.has_custom_box=!1,this.has_footer=!0,_.isUndefined(this.data)||(_.isUndefined(this.data.title)||(this.title=this.data.title),_.isUndefined(this.data.image)||(this.image=this.data.image),_.isUndefined(this.data.image_x2)||(this.image_x2=this.data.image_x2)),this.initialize();var a=Forminator.Utils.template(t(n).find("#popup-integration-content-tpl").html());this.$popup.find(".sui-box").html(a({image:this.image,image_x2:this.image_x2,title:this.title}));var r=this,s=function(){return r.close(),!1};if(o&&this.$popup.addClass(o),e.apply(this.$popup.get(),i),this.action_text&&this.action_callback){var l=this.action_callback;this.$popup.find(".sui-box-footer").append('<button class="forminator-popup-action sui-button '+this.action_css_class+'">'+this.action_text+"</button>"),this.$popup.find(".forminator-popup-action").on("click",function(){l&&l.apply(),r.close()})}else this.$popup.find(".forminator-popup-action").remove();return this.$popup.find(".sui-dialog-close").on("click",s),this.$popup.on("click",".forminator-popup-cancel",s),SUI.openModal(this.$popupId,this.$focusAfterClosed),Forminator.Utils.sui_delegate_events(),this._deferred=new t.Deferred,this._deferred.promise()},close:function(t,n){Forminator.Events.trigger("forminator:addons:reload"),SUI.closeModal(),setTimeout(function(){n&&n.apply()},300),this._deferred.resolve(this.$popup,t)}},Stripe_Popup:{$popup:{},_deferred:{},initialize:function(){var e=Forminator.Utils.template(t(n).find("#popup-stripe-tpl").html());t("#forminator-stripe-popup").length?(t("#forminator-stripe-popup").remove(),this.initialize()):t("main.sui-wrap").append(e({provider_image:"",provider_image2:"",provider_title:""})),this.$popup=t("#forminator-stripe-popup"),this.$popupId="forminator-stripe-popup",this.$focusAfterClosed="wpbody-content"},open:function(e,i){this.data=i,this.title="",this.image="",this.image_x2="",this.action_text="",this.action_callback=!1,this.action_css_class="",this.has_custom_box=!1,this.has_footer=!0,_.isUndefined(this.data)||(_.isUndefined(this.data.title)||(this.title=this.data.title),_.isUndefined(this.data.image)||(this.image=this.data.image),_.isUndefined(this.data.image_x2)||(this.image_x2=this.data.image_x2)),this.initialize();var o=Forminator.Utils.template(t(n).find("#popup-stripe-content-tpl").html());this.$popup.find(".sui-box").html(o({image:this.image,image_x2:this.image_x2,title:this.title})),this.$popup.find(".sui-box-footer").css({"padding-top":"0"});var a=this,r=function(){return a.close(),!1};if(e.apply(this.$popup.get(),i),this.action_text&&this.action_callback){var s=this.action_callback;this.$popup.find(".sui-box-footer").append('<div class="sui-actions-right"><button class="forminator-popup-action sui-button '+this.action_css_class+'">'+this.action_text+"</button></div>"),this.$popup.find(".forminator-popup-action").on("click",function(){s&&s.apply(),a.close()})}else this.$popup.find(".forminator-popup-action").remove();return this.$popup.find(".forminator-popup-close").on("click",r),this.$popup.on("click",".forminator-popup-cancel",r),SUI.openModal(this.$popupId,this.$focusAfterClosed,void 0,!0,!0),Forminator.Utils.sui_delegate_events(),this._deferred=new t.Deferred,this._deferred.promise()},close:function(t,n){SUI.closeModal();var e=this;setTimeout(function(){e.$popup.closest(".sui-modal").removeClass("sui-modal-sm").removeClass("sui-modal-md").removeClass("sui-modal-lg").removeClass("sui-modal-xl"),n&&n.apply()},300),this._deferred.resolve(this.$popup,t)}},Notification:o,Slide_Popup:{$popup:{},_deferred:{},initialize:function(){var e=Forminator.Utils.template(t(n).find("#popup-slide-tpl").html());t("#forminator-popup").length?(t("#forminator-popup").remove(),this.initialize()):t("main.sui-wrap").append(e({})),this.$popup=t("#forminator-popup"),this.$popupId="forminator-popup",this.$focusAfterClosed="wpbody-content"},open:function(e,i,o,a){this.data=i,this.title="",this.action_text="",this.action_callback=!1,this.action_css_class="",this.has_custom_box=!1,this.has_footer=!0;var r="";switch(a){case"inline":r=Forminator.Utils.template(t(n).find("#popup-header-inline-tpl").html());break;case"center":r=Forminator.Utils.template(t(n).find("#popup-header-tpl").html())}_.isUndefined(this.data)||(_.isUndefined(this.data.title)||(this.title=this.data.title),_.isUndefined(this.data.has_footer)||(this.has_footer=this.data.has_footer),_.isUndefined(this.data.action_callback)||_.isUndefined(this.data.action_text)||(this.action_callback=this.data.action_callback,this.action_text=this.data.action_text,_.isUndefined(this.data.action_css_class)||(this.action_css_class=this.data.action_css_class)),_.isUndefined(this.data.has_custom_box)||(this.has_custom_box=this.data.has_custom_box)),this.initialize(),""!==r&&this.$popup.html(r({title:this.title}));var s=this,l=function(){return s.close(),!1};if(o&&this.$popup.closest(".sui-modal").addClass("sui-modal-"+o),this.has_custom_box)e.apply(this.$popup.get(),i);else{var p='<div class="sui-box-body"></div>';this.has_footer&&(p+='<div class="sui-box-footer"><button class="sui-button forminator-popup-cancel">'+Forminator.l10n.popup.cancel+"</button></div>"),this.$popup.append(p),e.apply(this.$popup.find(".sui-box-body").get(),i)}if(this.action_text&&this.action_callback){var d=this.action_callback;this.$popup.find(".sui-box-footer").append('<div class="sui-actions-right"><button class="forminator-popup-action sui-button '+this.action_css_class+'">'+this.action_text+"</button></div>"),this.$popup.find(".forminator-popup-action").on("click",function(){d&&d.apply(),s.close()})}else this.$popup.find(".forminator-popup-action").remove();return this.$popup.find(".forminator-popup-close").on("click",l),this.$popup.find(".forminator-popup-cancel").on("click",l),this.$popup.on("click",".forminator-popup-cancel",l),SUI.openModal(this.$popupId,this.$focusAfterClosed,void 0,!0,!0),Forminator.Utils.sui_delegate_events(),this._deferred=new t.Deferred,this._deferred.promise()},close:function(t,n){var e=this;SUI.closeModal(),setTimeout(function(){e.$popup.closest(".sui-modal").removeClass("sui-modal-sm").removeClass("sui-modal-md").removeClass("sui-modal-lg").removeClass("sui-modal-xl"),n&&n.apply()},300),this._deferred.resolve(this.$popup,t)}}}})}(jQuery),function(t){formintorjs.define("admin/dashboard",[],function(n){return new(Backbone.View.extend({el:".wpmudev-dashboard-section",events:{"click .wpmudev-action-close":"dismiss_welcome"},initialize:function(){var n=Forminator.Utils.get_url_param("notification"),e=Forminator.Utils.get_url_param("title"),i=Forminator.Utils.get_url_param("createnew");if(setTimeout(function(){t(".forminator-scroll-to").length&&t("html, body").animate({scrollTop:t(".forminator-scroll-to").offset().top-50},"slow")},100),n){var o=_.template("<strong>{{ formName }}</strong> {{ Forminator.l10n.options.been_published }}");Forminator.Notification.open("success",o({formName:Forminator.Utils.sanitize_uri_string(e)}),4e3)}return i&&setTimeout(function(){jQuery(".forminator-create-"+i).click()},200),this.render()},dismiss_welcome:function(n){n.preventDefault();var e=t(n.target).closest(".sui-box"),i=t(n.target).data("nonce");e.slideToggle(300,function(){t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_dismiss_welcome",_ajax_nonce:i},complete:function(t){e.remove()}})})},render:function(){t("#forminator-new-feature").length>0&&setTimeout(function(){SUI.openModal("forminator-new-feature","wpbody-content")},300)}}))})}(jQuery),function(t){formintorjs.define("admin/settings-page",[],function(){var n=Backbone.View.extend({el:".wpmudev-forminator-forminator-settings, .wpmudev-forminator-forminator-addons",events:{"click .sui-side-tabs label.sui-tab-item input":"sidetabs","click .sui-sidenav .sui-vertical-tab a":"sidenav","change .sui-sidenav select.sui-mobile-nav":"sidenav_select","click .stripe-connect-modal":"open_stripe_connect_modal","click .paypal-connect-modal":"open_paypal_connect_modal","click .forminator-stripe-connect":"connect_stripe","click .disconnect_stripe":"disconnect_stripe","click .forminator-connect-addon":"connect_addon","click .forminator-paypal-connect":"connect_paypal","click .disconnect_paypal":"disconnect_paypal","click button.sui-tab-item":"buttonTabs","click .forminator-toggle-unsupported-settings":"show_unsupported_settings","click .forminator-dismiss-unsupported":"hide_unsupported_settings","click button.addons-configure":"open_configure_connect_modal","keyup input.forminator-custom-directory-value":"show_custom_directory"},initialize:function(){var n=this;if(t(".wpmudev-forminator-forminator-settings").length||t(".wpmudev-forminator-forminator-addons").length){this.$el.find(".forminator-settings-save").submit(function(e){e.preventDefault();var i=t(this),o=i.find(".wpmudev-action-done").data("nonce"),a=i.find(".wpmudev-action-done").data("action"),r=i.find(".wpmudev-action-done").data("title"),s=i.find(".wpmudev-action-done").data("isReload");n.submitForm(t(this),a,o,r,s)});var e=window.location.hash;_.isUndefined(e)||_.isEmpty(e)||this.sidenav_go_to(e.substring(1),!0),this.renderHcaptcha(),this.render("v2"),this.render("v2-invisible"),this.render("v3"),this.captchaTab()}},captchaTab:function(){var n=this.$el.find('input[name="captcha_tab_saved"]');this.$el.find("button.captcha-main-tab").on("click",function(e){e.preventDefault(),n.val(t(this).data("tab-name"))})},render:function(n){var e=this.$el.find("#"+n+"-recaptcha-preview");e.html('<p class="fui-loading-dialog"><i class="sui-icon-loader sui-loading" aria-hidden="true"></i></p>'),t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_load_recaptcha_preview",_ajax_nonce:forminatorData.loadCaptcha,captcha:n}}).done(function(t){t.success&&e.html(t.data)})},renderHcaptcha:function(){var n=this.$el.find("#hcaptcha-preview");n.html('<p class="fui-loading-dialog"><i class="sui-icon-loader sui-loading" aria-hidden="true"></i></p>'),t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_load_hcaptcha_preview",_ajax_nonce:forminatorData.loadCaptcha}}).done(function(t){t.success&&n.html(t.data)})},submitForm:function(n,e,i,o,a){var r={},s=this;r.action="forminator_save_"+e+"_popup",r._ajax_nonce=i;var l=n.serialize()+"&"+t.param(r);t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:l,beforeSend:function(){n.find(".sui-button").prop("disabled",!0),n.find(".wpmudev-action-done").addClass("sui-button-onload")},success:function(i){var r=_.template("<strong>{{ tab }}</strong> {{ Forminator.l10n.commons.update_successfully }}"),l="success",p=r({tab:Forminator.Utils.sanitize_text_field(o)});if(i.success||(l="error",p=i.data),_.isUndefined(p)||Forminator.Notification.open(l,p,4e3),"captcha"===e)$captcha_tab_saved=n.find('input[name="captcha_tab_saved"]').val(),$captcha_tab_saved=""===$captcha_tab_saved?"recaptcha":$captcha_tab_saved,"recaptcha"===$captcha_tab_saved?(s.render("v2"),s.render("v2-invisible"),s.render("v3")):"hcaptcha"===$captcha_tab_saved&&s.renderHcaptcha();else if("geolocation_settings"===e){var d=!i.success,c=t("#forminator-settings--place-ip").parent();d?c.addClass("sui-form-field-error").find(".sui-error-message").removeClass("sui-hidden"):c.removeClass("sui-form-field-error").find(".sui-error-message").addClass("sui-hidden")}a&&window.location.reload()},error:function(t){Forminator.Notification.open("error",Forminator.l10n.commons.update_unsuccessfull,4e3)}}).always(function(){n.find(".sui-button").prop("disabled",!1),n.find(".wpmudev-action-done").removeClass("sui-button-onload")})},sidetabs:function(t){var n=this.$(t.target),e=n.parent("label"),i=n.data("tab-menu"),o=n.closest(".sui-side-tabs"),a=o.find(".sui-tabs-menu .sui-tab-item"),r=a.find("input");n.is("input")&&(a.removeClass("active"),r.removeAttr("checked"),o.find(".sui-tabs-content > div").removeClass("active"),e.addClass("active"),n.prop("checked","checked"),o.find('.sui-tabs-content div[data-tab-content="'+i+'"]').length&&o.find('.sui-tabs-content div[data-tab-content="'+i+'"]').addClass("active"))},sidenav:function(n){var e=t(n.target).data("nav");e&&this.sidenav_go_to(e,!0),n.preventDefault()},sidenav_select:function(n){var e=t(n.target).val();e&&this.sidenav_go_to(e,!0),n.preventDefault()},sidenav_go_to:function(t,n){var e=this.$el.find('a[data-nav="'+t+'"]'),i=e.closest(".sui-vertical-tabs"),o=i.find(".sui-vertical-tab"),a=this.$el.find(".sui-box[data-nav]"),r=this.$el.find('.sui-box[data-nav="'+t+'"]');n&&history.pushState({selected_tab:t},"Global Settings","admin.php?page=forminator-settings&section="+t),o.removeClass("current"),a.hide(),e.parent().addClass("current"),r.show()},open_configure_connect_modal:function(n){var e=t(n.target),i=e.data("slug"),o=e.data("action");"stripe-connect-modal"===o?this.open_stripe_connect_modal(n):"paypal-connect-modal"===o?this.open_paypal_connect_modal(n):i&&this.open_connect_modal(n,i)},open_stripe_connect_modal:function(n){n.preventDefault();var e=this,i=t(n.target),o=i.data("modalImage"),a=i.data("modalImageX2"),r=i.data("modalTitle"),s=i.data("modalNonce"),l={title:Forminator.Utils.sanitize_text_field(r),image:o,image_x2:a};return Forminator.Stripe_Popup.open(function(){var n=t(this);e.render_stripe_connect_modal_content(n,s,{})},l),!1},render_stripe_connect_modal_content:function(n,e,i){var o=this;i.action="forminator_stripe_settings_modal",i._ajax_nonce=e,i.page_slug=Forminator.Utils.get_url_param("page");n.find(".sui-box-body").html('<p class="fui-loading-modal"><i class="sui-icon-loader sui-loading" aria-hidden="true"></i></p>'),t.post({url:Forminator.Data.ajaxUrl,type:"post",data:i}).done(function(t){if(t&&t.success){n.find(".sui-box-header h3.sui-box-title").show(),n.find(".sui-box-body").html(t.data.html);var i=t.data.buttons;n.find(".sui-box-footer").html(""),_.each(i,function(t){n.find(".sui-box-footer").append(t.markup)}),n.find(".sui-button").removeClass("sui-button-onload"),_.isUndefined(t.data.notification)||_.isUndefined(t.data.notification.type)||_.isUndefined(t.data.notification.text)||_.isUndefined(t.data.notification.duration)||(Forminator.Notification.open(t.data.notification.type,t.data.notification.text,t.data.notification.duration).done(function(){}),o.update_stripe_page(e))}})},update_stripe_page:function(n){var e={action:"forminator_stripe_update_page",_ajax_nonce:n};t.post({url:Forminator.Data.ajaxUrl,type:"get",data:e}).done(function(t){jQuery("#sui-box-stripe").html(t.data),Forminator.Utils.sui_delegate_events(),Forminator.Stripe_Popup.close()})},show_unsupported_settings:function(n){n.preventDefault(),t(".forminator-unsupported-settings").show()},hide_unsupported_settings:function(n){n.preventDefault(),t(".forminator-unsupported-settings").hide()},connect_stripe:function(n){n.preventDefault();var e=t(n.target);e.addClass("sui-button-onload");var i=e.data("nonce"),o=this.$el.find("#forminator-stripe-popup"),a=o.find("form"),r=a.serializeArray(),s={};return t.map(r,function(t,n){s[t.name]=t.value}),s.connect=!0,this.render_stripe_connect_modal_content(o,i,s),!1},connect_addon:function(n){n.preventDefault();var e=t(n.target);e.addClass("sui-button-onload");var i=e.data("nonce"),o=this.$el.find("#forminator-stripe-popup"),a=o.find("form"),r=a.data("slug"),s=a.serializeArray(),l={};return t.map(s,function(t,n){l[t.name]=t.value}),l.connect=!0,this.render_connect_modal_content(r,o,i,l),!1},buttonTabs:function(t){var n=this.$(t.target),e=n.closest(".sui-tabs"),i=e.find(".sui-tabs-menu .sui-tab-item"),o=e.find(".sui-tabs-content .sui-tab-content");n.is("button")&&(i.removeClass("active"),i.attr("tabindex","-1"),o.attr("hidden",!0),o.removeClass("active"),n.removeAttr("tabindex"),n.addClass("active"),e.find("#"+n.attr("aria-controls")).addClass("active"),e.find("#"+n.attr("aria-controls")).attr("hidden",!1),e.find("#"+n.attr("aria-controls")).removeAttr("hidden")),t.preventDefault()},open_connect_modal:function(n,e){n.preventDefault();var i=this,o=t(n.target),a=o.data("modalNonce");return Forminator.Stripe_Popup.open(function(){var n=t(this);i.render_connect_modal_content(e,n,a,{})},{title:forminatorl10n[e].configure_title,image:forminatorData.imagesUrl+"/"+e+"-logo.png",image_x2:forminatorData.imagesUrl+"/"+e+"-logo@2x.png"}),!1},render_connect_modal_content:function(n,e,i,o){var a=this;o.action="forminator_"+n+"_settings_modal",o._ajax_nonce=i;e.find(".sui-box-body").html('<p class="fui-loading-modal"><i class="sui-icon-loader sui-loading" aria-hidden="true"></i></p>'),t.post({url:Forminator.Data.ajaxUrl,type:"post",data:o}).done(function(t){if(t&&t.success){e.find(".sui-box-header h3.sui-box-title").show(),e.find(".sui-box-body").html(t.data.html);var n=t.data.buttons;e.find(".sui-box-footer").html(""),_.each(n,function(t){e.find(".sui-box-footer").append(t.markup)}),e.find(".sui-button").removeClass("sui-button-onload"),t.data.notification&&(a.openNotificaion(t.data.notification),a.closePopup())}else Forminator.Notification.open("error",t.data),a.closePopup()})},closePopup:function(){Forminator.Utils.sui_delegate_events(),Forminator.Stripe_Popup.close()},openNotificaion:function(t){_.isUndefined(t)||_.isUndefined(t.type)||_.isUndefined(t.text)||_.isUndefined(t.duration)||Forminator.Notification.open(t.type,t.text,t.duration).done(function(){})},open_paypal_connect_modal:function(n){n.preventDefault();var e=this,i=t(n.target),o=i.data("modalImage"),a=i.data("modalImageX2"),r=i.data("modalTitle"),s=i.data("modalNonce");return Forminator.Stripe_Popup.open(function(){var n=t(this);e.render_paypal_connect_modal_content(n,s,{})},{title:Forminator.Utils.sanitize_text_field(r),image:o,image_x2:a}),!1},render_paypal_connect_modal_content:function(n,e,i){var o=this;i.action="forminator_paypal_settings_modal",i._ajax_nonce=e,t.post({url:Forminator.Data.ajaxUrl,type:"post",data:i}).done(function(t){if(t&&t.success){n.find(".sui-box-header h3.sui-box-title").show(),n.find(".sui-box-body").html(t.data.html);var i=t.data.buttons;n.find(".sui-box-footer").html(""),_.each(i,function(t){n.find(".sui-box-footer").append(t.markup)}),n.find(".sui-button").removeClass("sui-button-onload"),_.isUndefined(t.data.notification)||_.isUndefined(t.data.notification.type)||_.isUndefined(t.data.notification.text)||_.isUndefined(t.data.notification.duration)||(Forminator.Notification.open(t.data.notification.type,t.data.notification.text,t.data.notification.duration).done(function(){}),o.update_paypal_page(e))}})},update_paypal_page:function(n){var e={action:"forminator_paypal_update_page",_ajax_nonce:n};t.post({url:Forminator.Data.ajaxUrl,type:"get",data:e}).done(function(t){jQuery("#sui-box-paypal").html(t.data),Forminator.Utils.sui_delegate_events(),Forminator.Stripe_Popup.close()})},connect_paypal:function(n){n.preventDefault();var e=t(n.target);e.addClass("sui-button-onload");var i=e.data("nonce"),o=this.$el.find("#forminator-stripe-popup"),a=o.find("form"),r=a.serializeArray(),s={};return t.map(r,function(t,n){s[t.name]=t.value}),s.connect=!0,this.render_paypal_connect_modal_content(o,i,s),!1},disconnect_stripe:function(n){var e=t(n.target),i={action:"forminator_disconnect_stripe",_ajax_nonce:e.data("nonce")};e.addClass("sui-button-onload"),t.post({url:Forminator.Data.ajaxUrl,type:"get",data:i}).done(function(t){jQuery("#sui-box-stripe").html(t.data.html),Forminator.Utils.sui_delegate_events(),Forminator.Stripe_Popup.close(),_.isUndefined(t.data.notification)||_.isUndefined(t.data.notification.type)||_.isUndefined(t.data.notification.text)||_.isUndefined(t.data.notification.duration)||Forminator.Notification.open(t.data.notification.type,t.data.notification.text,t.data.notification.duration).done(function(){})})},disconnect_paypal:function(n){var e=t(n.target),i={action:"forminator_disconnect_paypal",_ajax_nonce:e.data("nonce")};e.addClass("sui-button-onload"),t.post({url:Forminator.Data.ajaxUrl,type:"get",data:i}).done(function(t){jQuery("#sui-box-paypal").html(t.data.html),Forminator.Utils.sui_delegate_events(),Forminator.Stripe_Popup.close(),_.isUndefined(t.data.notification)||_.isUndefined(t.data.notification.type)||_.isUndefined(t.data.notification.text)||_.isUndefined(t.data.notification.duration)||Forminator.Notification.open(t.data.notification.type,t.data.notification.text,t.data.notification.duration).done(function(){})})},show_custom_directory:function(n){var e=t(n.target),i=e.val();t(".forminator-custom-directory strong").html(i)}}),n=new n;return n})}(jQuery);var forminator_render_admin_captcha=function(){setTimeout(function(){var t=jQuery(".forminator-g-recaptcha"),n=t.data("sitekey"),e=t.data("theme"),i=t.data("size");window.grecaptcha.render(t[0],{sitekey:n,theme:e,size:i})},100)},forminator_render_admin_captcha_v2=function(){setTimeout(function(){var t=jQuery(".forminator-g-recaptcha-v2"),n=t.data("sitekey"),e=t.data("theme"),i=t.data("size");window.grecaptcha.render(t[0],{sitekey:n,theme:e,size:i})},100)},forminator_render_admin_captcha_v2_invisible=function(){setTimeout(function(){var t=jQuery(".forminator-g-recaptcha-v2-invisible"),n=t.data("sitekey"),e=t.data("theme"),i=t.data("size");window.grecaptcha.render(t[0],{sitekey:n,theme:e,size:i,badge:"inline"})},100)},forminator_render_admin_captcha_v3=function(){setTimeout(function(){var t=jQuery(".forminator-g-recaptcha-v3"),n=t.data("sitekey"),e=t.data("theme"),i=t.data("size");window.grecaptcha.render(t[0],{sitekey:n,theme:e,size:i,badge:"inline"})},100)},forminator_render_admin_hcaptcha=function(){setTimeout(function(){var t=jQuery(".forminator-hcaptcha"),n=t.data("sitekey");hcaptcha.render(t[0],{sitekey:n})},1e3)};formintorjs.define("text!tpl/dashboard.html",[],function(){
    14 return'<div>\r\n\r\n\t\x3c!-- TEMPLATE: Delete --\x3e\r\n\t<script type="text/template" id="forminator-delete-popup-tpl">\r\n\r\n\t    <div class="sui-box-body sui-spacing-top--0">\r\n\t\t    <p id="forminator-popup__description" class="sui-description" style="margin: 5px 0 0; text-align: center;">{{ content }}</p>\r\n\t    </div>\r\n\r\n\t    <div class="sui-box-footer sui-flatten sui-content-center sui-spacing-top--10">\r\n\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<form method="post" class="delete-action">\r\n\r\n\t\t\t\t<input type="hidden" name="forminator_action" value="{{ action }}">\r\n\t\t\t\t<input type="hidden" name="id" value="{{ id }}">\r\n\t\t\t\t<input type="hidden" id="forminatorNonce" name="forminatorNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" id="forminatorEntryNonce" name="forminatorEntryNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" name="_wp_http_referer" value="{{ referrer }}">\r\n\r\n\t\t\t\t<button type="submit" class="sui-button sui-button-ghost sui-button-red popup-confirmation-confirm" style="margin: 0;">\r\n\t\t\t\t\t<span class="sui-icon-trash" aria-hidden="true"></span>\r\n\t\t\t\t\t{{ button }}\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</form>\r\n\r\n\t    </div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Create New Form (Base Structure) --\x3e\r\n\t<script type="text/template" id="forminator-new-form-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ Forminator.l10n.popup.enter_name }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-content-center sui-spacing-top--10"></div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button id="forminator-build-your-form" class="sui-button sui-button-blue">\r\n\t\t\t\t\t<span class="sui-loading-text">\r\n\t\t\t\t\t\t<i class="sui-icon-plus" aria-hidden="true"></i>\r\n\t\t\t\t\t\t{{Forminator.l10n.popup.create}}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Create New Form (Content) --\x3e\r\n\t<script type="text/template" id="forminator-new-form-content-tpl">\r\n\r\n\t\t<p id="forminator-popup__description" class="sui-description">{{ Forminator.l10n.popup.new_form_desc2 }}</p>\r\n\r\n\t\t<div\r\n\t\t\trole="alert"\r\n\t\t\tid="forminator-template-register-notice"\r\n\t\t\tclass="sui-notice sui-notice-blue"\r\n\t\t\taria-live="assertive"\r\n\t\t>\r\n\r\n\t\t\t<div class="sui-notice-content">\r\n\r\n\t\t\t\t<div class="sui-notice-message">\r\n\r\n\t\t\t\t\t<span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\r\n\r\n\t\t\t\t\t<p style="text-align: left;">{{ Forminator.l10n.popup.registration_notice }}</p>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div\r\n\t\t\trole="alert"\r\n\t\t\tid="forminator-template-login-notice"\r\n\t\t\tclass="sui-notice sui-notice-blue"\r\n\t\t\taria-live="assertive"\r\n\t\t>\r\n\r\n\t\t\t<div class="sui-notice-content">\r\n\r\n\t\t\t\t<div class="sui-notice-message">\r\n\r\n\t\t\t\t\t<span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\r\n\r\n\t\t\t\t\t<p style="text-align: left;">{{ Forminator.l10n.popup.login_notice }}</p>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div id="forminator-form-name-input" class="sui-form-field">\r\n\r\n\t\t\t<label for="forminator-form-name" class="sui-screen-reader-text">{{ Forminator.l10n.popup.input_label }}</label>\r\n\t\t\t<input type="text"\r\n\t\t\t       id="forminator-form-name"\r\n\t\t\t       class="sui-form-control fui-required"\r\n\t\t\t       placeholder="{{Forminator.l10n.popup.new_form_placeholder}}" autofocus>\r\n\t\t\t<span class="sui-error-message" style="display: none;">{{Forminator.l10n.popup.form_name_validation}}</span>\r\n\r\n\t\t</div>\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Create Poll --\x3e\r\n\t<script type="text/template" id="forminator-new-poll-content-tpl">\r\n\t\t<p class="sui-description" style="text-align: center;">{{ Forminator.l10n.popup.new_poll_desc2 }}</p>\r\n\r\n\t\t<div id="forminator-form-name-input" class="sui-form-field">\r\n\r\n\t\t\t<label for="forminator-form-name" class="sui-screen-reader-text">{{ Forminator.l10n.popup.input_label }}</label>\r\n\t\t\t<input type="text"\r\n\t\t\t       id="forminator-form-name"\r\n\t\t\t       class="sui-form-control fui-required"\r\n\t\t\t       placeholder="{{Forminator.l10n.popup.new_poll_placeholder}}" autofocus>\r\n\t\t\t<span class="sui-error-message" style="display: none;">{{Forminator.l10n.popup.poll_name_validation}}</span>\r\n\r\n\t\t</div>\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Create Quiz, Step 1 --\x3e\r\n\t<script type="text/template" id="forminator-quizzes-popup-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg" style="overflow: initial; white-space: initial; text-overflow: none;">{{ Forminator.l10n.quiz.choose_quiz_title }}</h3>\r\n\r\n\t\t\t<p id="forminator-popup__description" class="sui-description">{{ Forminator.l10n.quiz.choose_quiz_description }}</p>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-content-center sui-spacing-bottom--10">\r\n\r\n\t\t\t<div id="forminator-form-name-input" class="sui-form-field">\r\n\r\n\t\t\t\t<label for="forminator-form-name" class="sui-label">{{ Forminator.l10n.quiz.quiz_name }}</label>\r\n\r\n\t\t\t\t<input\r\n\t\t\t\t\ttype="text"\r\n\t\t\t\t\tid="forminator-form-name"\r\n\t\t\t\t\tclass="sui-form-control fui-required"\r\n\t\t\t\t\tplaceholder="{{Forminator.l10n.popup.new_quiz_placeholder}}"\r\n\t\t\t\t\tautofocus\r\n\t\t\t\t/>\r\n\t\t\t\t<span class="sui-error-message" style="display: none;">{{Forminator.l10n.popup.quiz_name_validation}}</span>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t\t<label class="sui-label">{{ Forminator.l10n.quiz.quiz_type }}</label>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-selectors" style="margin: 0;">\r\n\r\n\t\t\t<ul>\r\n\r\n\t\t\t\t<li><label for="forminator-new-quiz--knowledge" class="sui-box-selector">\r\n\t\t\t\t\t<input\r\n\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\tname="forminator-new-quiz"\r\n\t\t\t\t\t\tid="forminator-new-quiz--knowledge"\r\n\t\t\t\t\t\tclass="forminator-new-quiz-type"\r\n\t\t\t\t\t\tvalue="knowledge"\r\n\t\t\t\t\t\tchecked="checked"\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<span>\r\n\t\t\t\t\t\t<i class="sui-icon-academy" aria-hidden="true"></i>\r\n\t\t\t\t\t\t{{ Forminator.l10n.quiz.knowledge_label }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<span>{{ Forminator.l10n.quiz.knowledge_description }}</span>\r\n\t\t\t\t</label></li>\r\n\r\n\t\t\t\t<li><label for="forminator-new-quiz--nowrong" class="sui-box-selector">\r\n\t\t\t\t\t<input\r\n\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\tname="forminator-new-quiz"\r\n\t\t\t\t\t\tid="forminator-new-quiz--nowrong"\r\n\t\t\t\t\t\tclass="forminator-new-quiz-type"\r\n\t\t\t\t\t\tvalue="nowrong"\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<span>\r\n\t\t\t\t\t\t<i class="sui-icon-community-people" aria-hidden="true"></i>\r\n\t\t\t\t\t\t{{ Forminator.l10n.quiz.nowrong_label }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<span>{{ Forminator.l10n.quiz.nowrong_description }}</span>\r\n\t\t\t\t</label></li>\r\n\r\n\t\t\t</ul>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-spacing-top--30">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button select-quiz-template">\r\n\t\t\t\t\t<span class="sui-loading-text">{{ Forminator.l10n.quiz.continue_button }}</span>\r\n\t\t\t\t\t<i class="sui-icon-load sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Create Quiz, Step 2 (Pagination) --\x3e\r\n\t<script type="text/template" id="forminator-new-quiz-pagination-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--left forminator-popup-back">\r\n\t\t\t\t<span class="sui-icon-chevron-left sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.go_back }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close">\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg" style="overflow: initial; text-overflow: none; white-space: initial;">{{ Forminator.l10n.quiz.quiz_pagination }}</h3>\r\n\r\n\t\t\t<p id="forminator-popup__description" class="sui-description">\r\n\t\t\t\t{{ Forminator.l10n.quiz.quiz_pagination_descr }}<br>\r\n\t\t\t\t{{ Forminator.l10n.quiz.quiz_pagination_descr2 }}\r\n\t\t\t</p>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-spacing-bottom--10">\r\n\r\n\t\t\t<label class="sui-label">{{ Forminator.l10n.quiz.presentation }}</label>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-selectors" style="margin: 0;">\r\n\r\n\t\t\t<ul>\r\n\r\n\t\t\t\t<li><label class="sui-box-selector">\r\n\t\t\t\t\t<input\r\n\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\tname="forminator-quiz-pagination"\r\n\t\t\t\t\t\tvalue="0"\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<span>\r\n\t\t\t\t\t\t{{ Forminator.l10n.quiz.no_pagination }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</label></li>\r\n\r\n\t\t\t\t<li><label class="sui-box-selector">\r\n\t\t\t\t\t<input\r\n\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\tname="forminator-quiz-pagination"\r\n\t\t\t\t\t\tvalue="1"\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<span>\r\n\t\t\t\t\t\t{{ Forminator.l10n.quiz.paginate_quiz }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</label></li>\r\n\r\n\t\t\t</ul>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-spacing-top--30">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button select-quiz-pagination">\r\n\t\t\t\t\t<span class="sui-loading-text">{{ Forminator.l10n.quiz.continue_button }}</span>\r\n\t\t\t\t\t<i class="sui-icon-load sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Create Quiz, Step 3A (Leads Base Structure) --\x3e\r\n\t<script type="text/template" id="forminator-new-quiz-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--left forminator-popup-back">\r\n\t\t\t\t<span class="sui-icon-chevron-left sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.go_back }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close forminator-cancel-create-form">\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ Forminator.l10n.quiz.collect_leads }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10"></div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-separated">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button id="forminator-build-your-form" class="sui-button sui-button-blue">\r\n\t\t\t\t\t<span class="sui-loading-text">\r\n\t\t\t\t\t\t<i class="sui-icon-plus" aria-hidden="true"></i> {{ Forminator.l10n.quiz.create_quiz }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Create Quiz, Step 3B (Leads Content) --\x3e\r\n\t<script type="text/template" id="forminator-new-quiz-content-tpl">\r\n\r\n\t\t<p class="sui-description" style="text-align: center;">{{ Forminator.l10n.popup.new_quiz_desc2 }}\r\n\t\t\t{[ if( Forminator.Data.showDocLink ) { ]}\r\n\t\t\t\t<a href="https://wpmudev.com/docs/wpmu-dev-plugins/forminator/?utm_source=forminator&utm_medium=plugin&utm_campaign=capture_leads_learnmore_link#leads" target="_blank">\r\n\t\t\t\t\t{{ Forminator.l10n.popup.learn_more }}\r\n\t\t\t\t</a>\r\n\t\t\t{[ } ]}\r\n\t\t</p>\r\n\r\n\t\t<div class="sui-form-field">\r\n\r\n\t\t\t<label for="forminator-new-quiz-leads" class="sui-toggle fui-highlighted-toggle">\r\n\r\n\t\t\t\t<input\r\n\t\t\t\t\ttype="checkbox"\r\n\t\t\t\t\tid="forminator-new-quiz-leads"\r\n\t\t\t\t\taria-labelledby="forminator-new-quiz-leads-label"\r\n\t\t\t\t/>\r\n\r\n\t\t\t\t<span class="sui-toggle-slider" aria-hidden="true"></span>\r\n\r\n\t\t\t\t<span id="forminator-new-quiz-leads-label" class="sui-toggle-label">{{ Forminator.l10n.quiz.quiz_leads_toggle }}</span>\r\n\r\n\t\t\t</label>\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="alert"\r\n\t\t\t\tid="sui-quiz-leads-description"\r\n\t\t\t\tclass="sui-notice sui-notice-blue"\r\n\t\t\t\taria-live="assertive"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-notice-content">\r\n\r\n\t\t\t\t\t<div class="sui-notice-message">\r\n\r\n\t\t\t\t\t\t<span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\r\n\r\n\t\t\t\t\t\t<p>{{ Forminator.l10n.quiz.quiz_leads_desc }}</p>\r\n\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Export Schedule (on Submissions page) --\x3e\r\n\t<script type="text/template" id="forminator-exports-schedule-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\r\n\t\t\t<div class="sui-box-settings-row">\r\n\r\n\t\t\t\t<div class="sui-box-settings-col-2">\r\n\r\n\t\t\t\t\t<span class="sui-settings-label sui-dark">{{ Forminator.l10n.popup.manual_exports }}</span>\r\n\t\t\t\t\t<span class="sui-description">{{ Forminator.l10n.popup.manual_description }}</span>\r\n\r\n\t\t\t\t\t<form method="post" style="margin-top: 10px;">\r\n\r\n\t\t\t\t\t\t<input type="hidden" name="forminator_export" value="1" />\r\n\t\t\t\t\t\t<input type="hidden" name="form_id" value="{{ Forminator.l10n.exporter.form_id }}" />\r\n\t\t\t\t\t\t<input type="hidden" name="form_type" value="{{ Forminator.l10n.exporter.form_type }}" />\r\n\t\t\t\t\t\t<input type="hidden" name="_forminator_nonce" value="{{ Forminator.l10n.exporter.export_nonce }}" />\r\n\r\n\t\t\t\t\t\t<button class="sui-button sui-button-ghost">{{ Forminator.l10n.popup.download_csv }}</button>\r\n\r\n\t\t\t\t\t\t{[ if( \'cform\' === Forminator.l10n.exporter.form_type || \'quiz\' === Forminator.l10n.exporter.form_type ) { ]}\r\n\t\t\t\t\t\t\t<label for="apply-submission-filter" class="sui-checkbox sui-checkbox-sm sui-checkbox-stacked" style="margin-top: 20px;">\r\n\t\t\t\t\t\t\t\t<input type="checkbox" name="submission-filter" id="apply-submission-filter" value="yes" />\r\n\t\t\t\t\t\t\t\t<span aria-hidden="true"></span>\r\n\t\t\t\t\t\t\t\t<span>{{ Forminator.l10n.popup.apply_submission_filter }}</span>\r\n\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t{[ } ]}\r\n\r\n\t\t\t\t\t</form>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t\t<form method="post" class="sui-box-settings-row schedule-action">\r\n\r\n\t\t\t\t<div class="sui-box-settings-col-2">\r\n\r\n\t\t\t\t\t<span class="sui-settings-label sui-dark">{{ Forminator.l10n.popup.scheduled_exports }}</span>\r\n\t\t\t\t\t<span class="sui-description">{{ Forminator.l10n.popup.scheduled_description }}</span>\r\n\r\n\t\t\t\t\t<div class="sui-side-tabs" style="margin-top: 10px;">\r\n\r\n\t\t\t\t\t\t<div class="sui-tabs-menu tab-labels">\r\n\r\n\t\t\t\t\t\t\t<label for="forminator-disable-scheduled-exports" class="sui-tab-item tab-label-disable">\r\n\t\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\t\t\t\tname="enabled"\r\n\t\t\t\t\t\t\t\t\tvalue="false"\r\n\t\t\t\t\t\t\t\t\tid="forminator-disable-scheduled-exports"\r\n\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t{{ Forminator.l10n.popup.disable }}\r\n\t\t\t\t\t\t\t</label>\r\n\r\n\t\t\t\t\t\t\t<label for="forminator-enable-scheduled-exports" class="sui-tab-item tab-label-enable">\r\n\t\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\t\t\t\tname="enabled"\r\n\t\t\t\t\t\t\t\t\tvalue="true"\r\n\t\t\t\t\t\t\t\t\tid="forminator-enable-scheduled-exports"\r\n\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t{{ Forminator.l10n.popup.enable }}\r\n\t\t\t\t\t\t\t</label>\r\n\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t<div class="sui-tabs-content schedule-enabled">\r\n\r\n\t\t\t\t\t\t\t<div id="forminator-export-schedule-timeframe" class="sui-tab-content sui-tab-boxed active">\r\n\r\n\t\t\t\t\t\t\t\t<div class="sui-row">\r\n\r\n\t\t\t\t\t\t\t\t\t<div class="sui-col-md-6">\r\n\r\n\t\t\t\t\t\t\t\t\t\t<div class="sui-form-field">\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.frequency }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t<select name="interval" class="sui-select">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="daily">{{ Forminator.l10n.popup.daily }}</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="weekly">{{ Forminator.l10n.popup.weekly }}</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="monthly">{{ Forminator.l10n.popup.monthly }}</option>\r\n\t\t\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t<div class="sui-col-md-6">\r\n\r\n\t\t\t\t\t\t\t\t\t\t<div class="sui-form-field">\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.day_time }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t<select name="hour" class="sui-select">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="00:00">12:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="01:00">01:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="02:00">02:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="03:00">03:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="04:00">04:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="05:00">05:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="06:00">06:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="07:00">07:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="08:00">08:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="09:00">09:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="10:00">10:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="11:00">11:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="12:00">12:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="13:00">01:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="14:00">02:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="15:00">03:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="16:00">04:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="17:00">05:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="18:00">06:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="19:00">07:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="20:00">08:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="21:00">09:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="22:00">10:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="23:00">11:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t<div class="sui-form-field">\r\n\r\n\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.week_day }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t<select name="day" class="sui-select">\r\n\t\t\t\t\t\t\t\t\t\t<option value="mon">{{ Forminator.l10n.popup.monday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="tue">{{ Forminator.l10n.popup.tuesday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="wed">{{ Forminator.l10n.popup.wednesday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="thu">{{ Forminator.l10n.popup.thursday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="fri">{{ Forminator.l10n.popup.friday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="sat">{{ Forminator.l10n.popup.saturday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="sun">{{ Forminator.l10n.popup.sunday }}</option>\r\n\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t<div class="sui-form-field">\r\n\r\n\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.day_month }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t<select name="month_day" class="sui-select">\r\n\t\t\t\t\t\t\t\t\t\t<option value="1">1</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="2">2</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="3">3</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="4">4</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="5">5</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="6">6</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="7">7</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="8">8</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="9">9</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="10">10</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="11">11</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="12">12</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="13">13</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="14">14</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="15">15</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="16">16</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="17">17</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="18">18</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="19">19</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="20">20</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="21">21</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="22">22</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="23">23</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="24">24</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="25">25</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="26">26</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="27">27</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="28">28</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="29">29</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="30">30</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="31">31</option>\r\n\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t<div id="forminator-export-schedule-email" class="sui-form-field" style="margin-bottom: 20px;">\r\n\r\n\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.email_to }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t<select name="email[]" class="sui-select fui-multi-select wpmudev-select" multiple="multiple">\r\n\t\t\t\t\t\t\t\t\t\t{[ _.each( Forminator.l10n.exporter.email, function ( email ) { ]}\r\n\t\t\t\t\t\t\t\t\t\t<option value="{{ email }}" selected="selected">{{ email }}</option>\r\n\t\t\t\t\t\t\t\t\t\t{[ }) ]}\r\n\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t\t<input type="hidden" name="form_id" value="{{ Forminator.l10n.exporter.form_id }}"/>\r\n\t\t\t\t\t\t\t\t\t<input type="hidden" name="form_type" value="{{ Forminator.l10n.exporter.form_type }}"/>\r\n\t\t\t\t\t\t\t\t\t<input type="hidden" name="action" value="forminator_export_entries"/>\r\n\t\t\t\t\t\t\t\t\t<input type="hidden" name="_forminator_nonce" value="{{ Forminator.l10n.exporter.export_nonce }}"/>\r\n\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t<label for="forminator-send-if-new-exports" class="sui-checkbox sui-checkbox-sm sui-checkbox-stacked">\r\n\t\t\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\t\t\ttype="checkbox"\r\n\t\t\t\t\t\t\t\t\t\tname="if_new"\r\n\t\t\t\t\t\t\t\t\t\tvalue="true"\r\n\t\t\t\t\t\t\t\t\t\tid="forminator-send-if-new-exports"\r\n\t\t\t\t\t\t\t\t\t\tclass="forminator-field-singular"\r\n\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t<span aria-hidden="true"></span>\r\n\t\t\t\t\t\t\t\t\t<span class="sui-description">{{ Forminator.l10n.popup.scheduled_export_if_new }}</span>\r\n\t\t\t\t\t\t\t\t</label>\r\n\r\n\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</form>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer">\r\n\r\n\t\t\t<button class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide="forminator-popup">{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button type="submit" class="sui-button wpmudev-action-done">{{ Forminator.l10n.popup.save }}</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Reset Plugin (on Settings page) --\x3e\r\n\t<script type="text/template" id="forminator-reset-plugin-settings-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10">\r\n\t\t\t<p class="sui-description" style="text-align: center;">{{ content }}</p>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<form method="post" class="delete-action">\r\n\t\t\t\t<input type="hidden" name="forminator_action" value="reset_plugin_settings">\r\n\t\t\t\t<input type="hidden" id="forminatorNonce" name="forminatorNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" name="_wp_http_referer" value="{{ referrer }}&forminator_notice=settings_reset">\r\n\t\t\t\t<button type="submit" class="sui-button sui-button-ghost sui-button-red popup-confirmation-confirm">\r\n\t\t\t\t\t<span class="sui-loading-text" aria-hidden="true">\r\n\t\t\t\t\t\t<i class="sui-icon-refresh" aria-hidden="true"></i>\r\n\t\t\t\t\t\t{{ Forminator.l10n.popup.reset }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\t\t\t</form>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Disconnect PayPal (on Settings page) --\x3e\r\n\t<script type="text/template" id="forminator-disconnect-paypal-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10">\r\n\t\t\t<p class="sui-description" style="text-align: center;">{{ content }}</p>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<button type="submit" class="disconnect_paypal sui-button sui-button-ghost sui-button-red popup-confirmation-confirm" data-nonce="{{ nonce }}" data-action="disconnect_paypal">\r\n\t\t\t\t{{ Forminator.l10n.popup.disconnect }}\r\n\t\t\t</button>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- TEMPLATE: Disconnect Stripe (on Settings page) --\x3e\r\n\t<script type="text/template" id="forminator-disconnect-stripe-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10">\r\n\t\t\t<p class="sui-description" style="text-align: center;">{{ content }}</p>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<button type="submit" class="disconnect_stripe sui-button sui-button-ghost sui-button-red popup-confirmation-confirm" data-nonce="{{ nonce }}" data-action="disconnect_stripe">\r\n\t\t\t\t<i class="sui-icon-refresh" aria-hidden="true"></i>\r\n\t\t\t\t{{ Forminator.l10n.popup.disconnect }}\r\n\t\t\t</button>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n    <script type="text/template" id="forminator-login-popup-tpl">\r\n\r\n        <div class="wpmudev-row">\r\n\r\n            <div class="wpmudev-col col-12 col-sm-6">\r\n\r\n                <a class="wpmudev-popup--logreg" href="{{ loginUrl }}">\r\n\r\n                    <div class="wpmudev-logreg--header">\r\n\r\n                        <span class="wpdui-icon wpdui-icon-key"></span>\r\n\r\n                        <h3 class="wpmudev-logreg--title">{{ Forminator.l10n.login.login_label }}</h3>\r\n\r\n                    </div>\r\n\r\n                    <div class="wpmudev-logreg--section">\r\n\r\n                        <p class="wpmudev-logreg--description">{{ Forminator.l10n.login.login_description }}</p>\r\n\r\n                        <div class="wpmudev-logreg--image">\r\n                            <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"\r\n                                 width="110" height="140" viewBox="0 0 110 140" preserveAspectRatio="none"\r\n                                 class="wpmudev-svg-login">\r\n                                <defs>\r\n                                    <path id="b" d="M0 40h100v94H0z"/>\r\n                                    <filter id="a" width="116%" height="117%" x="-8%" y="-7.4%"\r\n                                            filterUnits="objectBoundingBox">\r\n                                        <feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/>\r\n                                        <feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1"\r\n                                                        stdDeviation="2.5"/>\r\n                                        <feColorMatrix in="shadowBlurOuter1"\r\n                                                       values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>\r\n                                    </filter>\r\n                                    <path id="c" d="M10 112h6v6h-6z"/>\r\n                                    <path id="d" d="M10 90h80v15H10z"/>\r\n                                    <path id="e" d="M10 60h80v15H10z"/>\r\n                                </defs>\r\n                                <g fill="none" fill-rule="evenodd" transform="translate(5)">\r\n                                    <use fill="#000" filter="url(#a)" xlink:href="#b"/>\r\n                                    <use fill="#FFF" xlink:href="#b"/>\r\n                                    <rect width="22" height="12" x="68" y="112" fill="#0472AC" rx="3"/>\r\n                                    <path fill="#808285" d="M19 114h26v2H19z"/>\r\n                                    <use fill="#FBFBFB" xlink:href="#c"/>\r\n                                    <path stroke="#E1E1E1" d="M10.5 112.5h5v5h-5z"/>\r\n                                    <use fill="#FBFBFB" xlink:href="#d"/>\r\n                                    <path stroke="#E1E1E1" d="M10.5 90.5h79v14h-79z"/>\r\n                                    <path fill="#808285" d="M10 85h26v2H10z"/>\r\n                                    <use fill="#FBFBFB" xlink:href="#e"/>\r\n                                    <path stroke="#E1E1E1" d="M10.5 60.5h79v14h-79z"/>\r\n                                    <path fill="#808285" d="M10 55h50v2H10z"/>\r\n                                    <circle cx="50" cy="15" r="15" fill="#0272AC"/>\r\n                                </g>\r\n                            </svg>\r\n                        </div>\r\n\r\n                    </div>\r\n\r\n                </a>\r\n\r\n            </div>\r\n\r\n            <div class="wpmudev-col col-12 col-sm-6">\r\n\r\n                <a class="wpmudev-popup--logreg" href="{{ registerUrl }}">\r\n\r\n                    <div class="wpmudev-logreg--header">\r\n\r\n                        <span class="wpdui-icon wpdui-icon-profile-female"></span>\r\n\r\n                        <h3 class="wpmudev-logreg--title">{{ Forminator.l10n.login.registration_label }}</h3>\r\n\r\n                    </div>\r\n\r\n                    <div class="wpmudev-logreg--section">\r\n\r\n                        <p class="wpmudev-logreg--description">{{ Forminator.l10n.login.registration_description }}</p>\r\n\r\n                        <div class="wpmudev-logreg--image">\r\n                            <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"\r\n                                 width="183" height="97" viewBox="0 0 183 97" preserveAspectRatio="none"\r\n                                 class="wpmudev-svg-registration">\r\n                                <defs>\r\n                                    <path id="a" d="M0 58h183v15H0z"/>\r\n                                    <path id="b" d="M0 23h183v15H0z"/>\r\n                                </defs>\r\n                                <g fill="none" fill-rule="evenodd">\r\n                                    <rect width="50" height="14" y="83" fill="#353535" rx="3"/>\r\n                                    <path fill="#FBFBFB" stroke="#E1E1E1" d="M.5 58.5h182v14H.5z"/>\r\n                                    <path fill="#808285" d="M0 51h40v2H0z"/>\r\n                                    <path fill="#FBFBFB" stroke="#E1E1E1" d="M.5 23.5h182v14H.5z"/>\r\n                                    <path fill="#808285" d="M0 16h40v2H0z"/>\r\n                                    <path fill="#353535" d="M0 0h120v6H0z"/>\r\n                                </g>\r\n                            </svg>\r\n                        </div>\r\n\r\n                    </div>\r\n\r\n                </a>\r\n\r\n            </div>\r\n\r\n        </div>\r\n    <\/script>\r\n\r\n\t<script type="text/template" id="forminator-form-popup-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close">\r\n\t\t\t\t<span class="sui-icon-close" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ Forminator.l10n.form.form_template_title }}</h3>\r\n\r\n\t\t\t<p id="forminator-popup__description" class="sui-description">{{ Forminator.l10n.form.form_template_description }}</p>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-selectors sui-box-selectors-col-2">\r\n\r\n\t\t\t<ul>\r\n\r\n\t\t\t\t{[ _.each(templates, function(template){ ]}\r\n\r\n\t\t\t\t\t{[ if( template.options.id !== \'leads\' ) { ]}\r\n\r\n\t\t\t\t\t\t<li>\r\n\r\n\t\t\t\t\t\t\t<label for="forminator-new-quiz--{{ template.options.id }}" class="sui-box-selector">\r\n\r\n\t\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\t\t\t\t\tname="forminator-form-template"\r\n\t\t\t\t\t\t\t\t\t\tid="forminator-new-quiz--{{ template.options.id }}"\r\n\t\t\t\t\t\t\t\t\t\tclass="forminator-new-form-type"\r\n\t\t\t\t\t\t\t\t\t\tvalue="{{ template.options.id }}"\r\n\t\t\t\t\t\t\t\t\t\t{[ if( template.options.id === \'blank\' ) { ]}\r\n\t\t\t\t\t\t\t\t\t\tchecked="checked"\r\n\t\t\t\t\t\t\t\t\t\t{[ } ]}\r\n\t\t\t\t\t\t\t\t/>\r\n\r\n\t\t\t\t\t\t\t\t<span>\r\n\t\t\t\t\t\t\t\t\t<i class="sui-icon-{{template.options.icon}}" aria-hidden="true"></i>\r\n\t\t\t\t\t\t\t\t\t{{ template.options.name }}\r\n\t\t\t\t\t\t\t\t</span>\r\n\r\n\t\t\t\t\t\t\t</label>\r\n\r\n\t\t\t\t\t\t</li>\r\n\r\n\t\t\t\t\t{[ } ]}\r\n\r\n\t\t\t\t{[ }); ]}\r\n\r\n\t\t\t</ul>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button select-quiz-template">\r\n\t\t\t\t\t<span class="sui-loading-text">{{ Forminator.l10n.quiz.continue_button }}</span>\r\n\t\t\t\t\t<i class="sui-icon-load sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n    <script type="text/template" id="forminator-new-form-popup-tpl">\r\n\r\n        <div class="wpmudev-box--congrats">\r\n\r\n            <div class="wpmudev-congrats--image"></div>\r\n\r\n            <div class="wpmudev-congrats--message">\r\n\r\n                <p><strong>{{ title }}</strong> {{ Forminator.l10n.popup.is_ready }}<br/>\r\n\t\t\t\t\t{{ Forminator.l10n.popup.new_form_desc }}</p>\r\n\r\n            </div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n    <script type="text/template" id="forminator-confirmation-popup-tpl">\r\n\r\n\t    <div class="sui-box-body sui-content-center">\r\n\t\t    <p>{{ confirmation_message }}</p>\r\n\t    </div>\r\n\r\n        <div class="sui-box-footer sui-flatten sui-content-center">\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost popup-confirmation-cancel">{{ Forminator.l10n.popup.cancel }}</button>\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost sui-button-red popup-confirmation-confirm">\r\n\t\t\t\t<span class="sui-loading-text">{{ Forminator.l10n.popup.delete }}</span>\r\n\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t</button>\r\n        </div>\r\n\r\n    <\/script>\r\n\r\n\t<script type="text/template" id="forminator-delete-poll-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\t\t\t<span class="sui-description">{{ content }}</span>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer">\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\t\t\t<button type="submit" class="delete-poll-submission sui-button sui-button-ghost sui-button-red popup-confirmation-confirm" data-nonce="{{ nonce }}" data-id="{{ id }}" data-action="delete_poll_submissions">\r\n\t\t\t\t{{ Forminator.l10n.popup.delete }}\r\n\t\t\t</button>\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="forminator-approve-user-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\t\t\t<span class="sui-description">{{ content }}</span>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer">\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\t\t\t<form method="post" class="form-approve-user">\r\n\t\t\t\t<input type="hidden" name="forminator_action" value="approve_user">\r\n\t\t\t\t<input type="hidden" name="id" value="{{ id }}">\r\n\t\t\t\t<input type="hidden" name="activationKey" value="{{ activationKey }}">\r\n\t\t\t\t<input type="hidden" id="forminatorNonce" name="forminatorNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" id="forminatorEntryNonce" name="forminatorEntryNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" name="_wp_http_referer" value="{{ referrer }}">\r\n\t\t\t\t<button type="submit" class="sui-button approve-user popup-confirmation-confirm">\r\n\t\t\t\t\t{{ Forminator.l10n.popup.approve_user }}\r\n\t\t\t\t</button>\r\n\t\t\t</form>\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="forminator-delete-unconfirmed-user-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\t\t\t<span class="sui-description">{{ content }}</span>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer">\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\t\t\t<form method="post" class="form-delete-unconfirmed-user">\r\n\t\t\t\t<input type="hidden" name="forminatorAction" value="delete-unconfirmed-user">\r\n\t\t\t\t<input type="hidden" name="formId" value="{{ formId }}">\r\n\t\t\t\t<input type="hidden" name="entryId" value="{{ entryId }}">\r\n\t\t\t\t<input type="hidden" name="activationKey" value="{{ activationKey }}">\r\n\t\t\t\t<input type="hidden" id="forminatorNonceDeleteUnconfirmedUser" name="forminatorNonceDeleteUnconfirmedUser" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" name="_wp_http_referer" value="{{ referrer }}">\r\n\t\t\t\t<button type="submit" class="sui-button sui-button-ghost sui-button-red delete-unconfirmed-user popup-confirmation-confirm">\r\n\t\t\t\t\t<i class="sui-icon-trash" aria-hidden="true"></i>\r\n\t\t\t\t\t{{ Forminator.l10n.popup.delete }}\r\n\t\t\t\t</button>\r\n\t\t\t</form>\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="forminator-addons-action-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--0">\r\n\r\n\t\t\t{[ if( forms.length <= 0 ) { ]}\r\n\r\n\t\t\t\t<p id="forminator-popup__description" class="sui-description" style="text-align: center;">{{ Forminator.l10n.popup.deactivateContent }}</p>\r\n\r\n\t\t\t{[ } else { ]}\r\n\r\n\t\t\t\t<p id="forminator-popup__description" class="sui-description" style="text-align: center;">{{ content }}</p>\r\n\r\n\t\t\t\t<div class="form-list">\r\n\r\n\t\t\t\t\t<h4 class="sui-table-title" style="margin: 0 0 5px;">{{ Forminator.l10n.popup.forms }}</h4>\r\n\r\n\t\t\t\t\t<table class="sui-table" style="margin: 0;">\r\n\t\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t{[ _.each( forms, function( value, key ){ ]}\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td class="sui-table-item-title">\r\n\t\t\t\t\t\t\t\t\t<span class="sui-icon-clipboard-notes" aria-hidden="true"></span>\r\n\t\t\t\t\t\t\t\t\t{{ value }}\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<td width="73" style="text-align: right;">\r\n\t\t\t\t\t\t\t\t\t<a href="{{ forminatorData.formEditUrl + \'&id=\' + key }}" title="{{ value }}" class="sui-button-icon">\r\n\t\t\t\t\t\t\t\t\t\t<span class="sui-icon-pencil" aria-hidden="true"></span>\r\n\t\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t{[ }) ]}\r\n\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t</table>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t{[ } ]}\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-separated">\r\n\r\n\t\t\t<button type="button" class="sui-button forminator-popup-close" data-a11y-dialog-hide>\r\n\t\t\t\t{{ Forminator.l10n.popup.cancel }}\r\n\t\t\t</button>\r\n\r\n\t\t\t{[ if( forms.length <= 0 ) { ]}\r\n\t\t\t\t<button class="sui-button addons-actions" data-addon="{{ id }}" data-nonce="{{ nonce }}" data-popup="true" data-is_network="{{ is_network }}" data-action="addons-deactivate">\r\n\t\t\t\t\t{{ Forminator.l10n.popup.deactivate }}\r\n\t\t\t\t</button>\r\n\t\t\t{[ } else { ]}\r\n\t\t\t\t<button class="sui-button sui-button-ghost sui-button-red addons-actions" data-addon="{{ id }}" data-nonce="{{ nonce }}" data-popup="true" data-is_network="{{ is_network }}" data-action="addons-deactivate">\r\n\t\t\t\t\t{{ Forminator.l10n.popup.deactivateAnyway }}\r\n\t\t\t\t</button>\r\n\t\t\t{[ } ]}\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="forminator-apply-appearance-preset-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\t\t\t<span class="sui-description" style="text-align: center; margin: -15px 0 30px;">{{ description }}</span>\r\n\r\n\t\t\t<div class="sui-form-field" style="margin-bottom: 10px;">\r\n\t\t\t\t{{ selectbox }}\r\n\t\t\t</div>\r\n\r\n\t\t\t<div class="sui-notice" style="margin-top: 10px;">\r\n\t\t\t\t<div class="sui-notice-content">\r\n\t\t\t\t\t<div class="sui-notice-message">\r\n\t\t\t\t\t\t<span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span>\r\n\t\t\t\t\t\t<p>{{ notice }}</p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\t\t\t<button id="forminator-apply-preset" class="sui-button sui-button-blue">\r\n\t\t\t\t<span class="sui-button-text-default">\r\n\t\t\t\t\t<i class="sui-icon-check" aria-hidden="true"></i> {{ button }}\r\n\t\t\t\t</span>\r\n\t\t\t\t<span class="sui-button-text-onload">\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</span>\r\n\t\t\t</button>\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="forminator-create-appearance-preset-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-content-center">\r\n\t\t\t<span class="sui-description" style="margin: -15px 0 30px">{{ content }}</span>\r\n\r\n\t\t\t<div class="sui-form-field">\r\n\t\t\t\t<label for="forminator-preset-name" class="sui-label">{{ nameLabel }}</label>\r\n\t\t\t\t<input type="text"\r\n\t\t\t\t\t   id="forminator-preset-name"\r\n\t\t\t\t\t   class="sui-form-control fui-required"\r\n\t\t\t\t\t   placeholder="{{ namePlaceholder }}">\r\n\t\t\t</div>\r\n\r\n\t\t\t<div class="sui-form-field">\r\n\t\t\t\t<label class="sui-label">{{ formLabel }}</label>\r\n\t\t\t\t{{ forminatorData.forms_select }}\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\t\t\t<button id="forminator-create-preset" class="sui-button sui-button-blue" disabled="disabled">\r\n\t\t\t\t<span class="sui-button-text-default">\r\n\t\t\t\t\t<i class="sui-icon-plus" aria-hidden="true"></i> {{ title }}\r\n\t\t\t\t</span>\r\n\t\t\t\t<span class="sui-button-text-onload">\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t\t{{ loadingText }}\r\n\t\t\t\t</span>\r\n\t\t\t</button>\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n</div>\r\n'
    15 }),function(t){formintorjs.define("admin/popup/templates",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"forminator-popup-create--cform",step:"1",template:"blank",events:{"click .select-quiz-template":"selectTemplate","click .forminator-popup-close":"close","change .forminator-new-form-type":"clickTemplate","click #forminator-build-your-form":"handleMouseClick","focus #forminator-form-name":"resetNameSetup",keyup:"handleKeyClick"},popupTpl:Forminator.Utils.template(t(n).find("#forminator-form-popup-tpl").html()),newFormTpl:Forminator.Utils.template(t(n).find("#forminator-new-form-tpl").html()),newFormContent:Forminator.Utils.template(t(n).find("#forminator-new-form-content-tpl").html()),render:function(){var t=jQuery("#forminator-popup");"1"===this.step&&(this.$el.html(this.popupTpl({templates:Forminator.Data.modules.custom_form.templates})),this.$el.find(".select-quiz-template").prop("disabled",!1),t.closest(".sui-modal").removeClass("sui-modal-sm")),"2"===this.step&&(this.$el.html(this.newFormTpl()),this.$el.find(".sui-box-body").html(this.newFormContent()),"registration"===this.template&&(this.$el.find("#forminator-template-register-notice").show(),this.$el.find("#forminator-form-name").val(Forminator.l10n.popup.registration_name)),"login"===this.template&&(this.$el.find("#forminator-template-login-notice").show(),this.$el.find("#forminator-form-name").val(Forminator.l10n.popup.login_name)),t.closest(".sui-modal").addClass("sui-modal-sm"))},close:function(t){t.preventDefault(),Forminator.Popup.close()},clickTemplate:function(t){this.$el.find(".select-quiz-template").prop("disabled",!1)},selectTemplate:function(t){t.preventDefault();var n=this.$el.find("input[name=forminator-form-template]:checked").val();this.template=n,this.step="2",this.render()},handleMouseClick:function(t){this.createQuiz(t)},handleKeyClick:function(t){t.preventDefault(),13===t.which&&this.createQuiz(t)},resetNameSetup:function(n){var e=t(n.target).next(".sui-error-message");e.is(":visible")&&(e.hide(),this.$el.find("#forminator-build-your-form").removeClass("sui-button-onload"))},createQuiz:function(n){var e=t(n.target).addClass("sui-button-onload").closest(".sui-box").find("#forminator-form-name");if(""===e.val().trim())t(n.target).closest(".sui-box").find(".sui-error-message").show();else{var i=Forminator.Data.modules.custom_form.new_form_url;t(n.target).closest(".sui-box").find(".sui-error-message").hide(),form_url=i+"&name="+e.val(),form_url=form_url+"&template="+this.template,window.location.href=form_url}}})})}(jQuery),function(t){formintorjs.define("admin/popup/login",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-login-popup-tpl").html()),render:function(){this.$el.html(this.popupTpl({loginUrl:Forminator.Data.modules.login.login_url,registerUrl:Forminator.Data.modules.login.register_url}))}})})}(jQuery),function(t){formintorjs.define("admin/popup/quizzes",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"forminator-popup-create--quiz",step:1,pagination:0,type:"knowledge",events:{"click .select-quiz-template":"selectTemplate","click .select-quiz-pagination":"selectPagination","click .forminator-popup-back":"goBack","click .forminator-popup-close":"close","change .forminator-new-quiz-type":"clickTemplate","click #forminator-build-your-form":"handleMouseClick","click #forminator-new-quiz-leads":"handleToggle","focus #forminator-form-name":"resetNameSetup",keyup:"handleKeyClick"},popupTpl:Forminator.Utils.template(t(n).find("#forminator-quizzes-popup-tpl").html()),newFormTpl:Forminator.Utils.template(t(n).find("#forminator-new-quiz-tpl").html()),paginationTpl:Forminator.Utils.template(t(n).find("#forminator-new-quiz-pagination-tpl").html()),newFormContent:Forminator.Utils.template(t(n).find("#forminator-new-quiz-content-tpl").html()),render:function(){var t=jQuery("#forminator-popup");t.removeClass("sui-dialog-sm forminator-create-quiz-second-step forminator-create-quiz-pagination-step"),1===this.step&&(this.$el.html(this.popupTpl()),this.name&&(this.$el.find("#forminator-form-name").val(this.name),this.$el.find("#forminator-new-quiz--"+this.type).prop("checked",!0)),this.$el.find(".select-quiz-template").prop("disabled",!1)),2===this.step&&(this.$el.html(this.paginationTpl()),window.isTrue(this.pagination)?this.$el.find('[name="forminator-quiz-pagination"]').eq(1).prop("checked",!0):this.$el.find('[name="forminator-quiz-pagination"]').eq(0).prop("checked",!0),t.addClass("forminator-create-quiz-pagination-step")),3===this.step&&(this.$el.html(this.newFormTpl()),this.$el.find(".sui-box-body").html(this.newFormContent()),t.addClass("sui-dialog-sm forminator-create-quiz-second-step"))},close:function(t){t.preventDefault(),Forminator.Popup.close()},clickTemplate:function(t){this.$el.find(".select-quiz-template").prop("disabled",!1)},selectTemplate:function(n){n.preventDefault();var e=this.$el.find("input[name=forminator-new-quiz]:checked").val(),i=this.$el.find("#forminator-form-name").val();""===i.trim()?t(n.target).closest(".sui-box").find(".sui-error-message").show():(this.type=e,this.name=i,this.step=2,this.render())},goBack:function(t){t.preventDefault(),2==this.step&&(this.pagination=this.$el.find('input[name="forminator-quiz-pagination"]:checked').val()),this.step--,this.render()},selectPagination:function(t){t.preventDefault();var n=this.$el.find('input[name="forminator-quiz-pagination"]:checked').val();this.pagination=n,this.step=3,this.render()},handleMouseClick:function(t){this.createQuiz(t)},handleKeyClick:function(t){t.preventDefault(),13===t.which&&(1===this.step?this.selectTemplate(t):this.createQuiz(t))},handleToggle:function(n){var e=t(n.target).is(":checked"),i=t(n.target).closest(".sui-box").find("#sui-quiz-leads-description");e?i.show():i.hide()},resetNameSetup:function(n){var e=t(n.target).next(".sui-error-message");e.is(":visible")&&(e.hide(),this.$el.find("#forminator-build-your-form").removeClass("sui-button-onload"))},createQuiz:function(n){var e=t(n.target).addClass("sui-button-onload").closest(".sui-box").find("#forminator-new-quiz-leads").is(":checked"),i=Forminator.Data.modules.quizzes.knowledge_url;"nowrong"===this.type&&(i=Forminator.Data.modules.quizzes.nowrong_url),form_url=i+"&name="+this.name,window.isTrue(this.pagination)&&(form_url+="&pagination=true"),e&&(form_url+="&leads=true"),window.location.href=form_url}})})}(jQuery),function(t){formintorjs.define("admin/popup/schedule",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({popupTpl:Forminator.Utils.template(t(n).find("#forminator-exports-schedule-popup-tpl").html()),events:{'change select[name="interval"]':"on_change_interval","click .sui-toggle-label":"click_label","click .tab-labels .sui-tab-item":"click_tab_label","click .wpmudev-action-done":"submit_schedule"},render:function(){this.$el.html(this.popupTpl({})),Forminator.Utils.sui_delegate_events();var t=forminatorl10n.exporter;this.$el.find('input[name="if_new"]').prop("checked",t.if_new),this.set_enabled(t.enabled),this.$el.find('select[name="interval"]').change(),null!==t.email&&(this.$el.find('select[name="interval"]').val(t.interval),this.$el.find('select[name="day"]').val(t.day),this.$el.find('select[name="month_day"]').val(t.month_day?t.month_day:1),this.$el.find('select[name="hour"]').val(t.hour),"weekly"===t.interval?this.$el.find('select[name="day"]').closest(".sui-form-field").show():"monthly"===t.interval&&this.$el.find('select[name="month_day"]').closest(".sui-form-field").show(),this.load_select())},set_enabled:function(t){t?(this.$el.find('input[name="enabled"][value="true"]').prop("checked",!0),this.$el.find('input[name="enabled"][value="false"]').prop("checked",!1),this.$el.find(".tab-label-disable").removeClass("active"),this.$el.find(".tab-label-enable").addClass("active"),this.$el.find(".schedule-enabled").show(),this.$el.find('input[name="email"]').prop("required",!0)):(this.$el.find('input[name="enabled"][value="false"]').prop("checked",!0),this.$el.find('input[name="enabled"][value="true"]').prop("checked",!1),this.$el.find(".tab-label-disable").addClass("active"),this.$el.find(".tab-label-enable").removeClass("active"),this.$el.find(".schedule-enabled").hide())},load_select:function(){var t=forminatorl10n.exporter,n={tags:!0,tokenSeparators:[","," "],language:{searching:function(){return t.searching},noResults:function(){return t.noResults}},ajax:{url:forminatorData.ajaxUrl,type:"POST",delay:350,data:function(t){return{action:"forminator_builder_search_emails",_wpnonce:forminatorData.searchNonce,q:t.term,permission:"forminator-entries"}},processResults:function(t){return{results:t.data}},cache:!0},createTag:function(t){const n=t.term.trim();return Forminator.Utils.is_email_wp(n)?{id:n,text:n}:null},insertTag:function(t,n){t.push(n)}};Forminator.Utils.forminator_select2_tags(this.$el,n)},on_change_interval:function(t){this.$el.find('select[name="day"]').closest(".sui-form-field").hide(),this.$el.find('select[name="month_day"]').closest(".sui-form-field").hide(),"weekly"===t.target.value?(this.$el.find('select[name="month-day"]').closest(".sui-form-field").hide(),this.$el.find('select[name="day"]').closest(".sui-form-field").show()):"monthly"===t.target.value&&(this.$el.find('select[name="month_day"]').closest(".sui-form-field").show(),this.$el.find('select[name="day"]').closest(".sui-form-field").hide())},click_label:function(t){t.preventDefault(),this.$el.closest(".sui-form-field").find(".sui-toggle input").click()},click_tab_label:function(n){var e=t(n.target);e.closest(".sui-tab-item").hasClass("tab-label-disable")?this.set_enabled(!1):e.closest(".sui-tab-item").hasClass("tab-label-enable")&&(this.load_select(),this.set_enabled(!0))},submit_schedule:function(t){this.$el.find("form.schedule-action").trigger("submit")}})})}(jQuery),function(t){formintorjs.define("admin/popup/new-form",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-new-form-popup-tpl").html()),initialize:function(t){this.title=t.title,this.title=Forminator.Utils.sanitize_uri_string(this.title)},render:function(){this.$el.html(this.popupTpl({title:this.title}))}})})}(jQuery),function(t){formintorjs.define("admin/popup/polls",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-popup-templates",newFormTpl:Forminator.Utils.template(t(n).find("#forminator-new-form-tpl").html()),newPollContent:Forminator.Utils.template(t(n).find("#forminator-new-poll-content-tpl").html()),events:{"click #forminator-build-your-form":"handleMouseClick","focus #forminator-form-name":"resetNameSetup",keyup:"handleKeyClick"},initialize:function(t){this.options=t},render:function(){this.$el.html(this.newFormTpl()),this.$el.find(".sui-box-body").html(this.newPollContent())},handleMouseClick:function(t){this.create_poll(t)},handleKeyClick:function(t){t.preventDefault(),13===t.which&&this.create_poll(t)},resetNameSetup:function(n){var e=t(n.target).next(".sui-error-message");e.is(":visible")&&(e.hide(),this.$el.find("#forminator-build-your-form").removeClass("sui-button-onload"))},create_poll:function(n){n.preventDefault();var e=t(n.target).addClass("sui-button-onload").closest(".sui-box").find("#forminator-form-name");if(""===e.val().trim())t(n.target).closest(".sui-box").find(".sui-error-message").show();else{var i=Forminator.Data.modules.polls.new_form_url;t(n.target).closest(".sui-box").find(".sui-error-message").hide(),i=i+"&name="+e.val(),window.location.href=i}}})})}(jQuery),function(t){formintorjs.define("admin/popup/ajax",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"sui-box-body",events:{"click .wpmudev-action-done":"save","click .wpmudev-action-ajax-done":"ajax_save","click .wpmudev-action-ajax-cf7-import":"ajax_cf7_import","click .wpmudev-button-clear-exports":"clear_exports","click .forminator-radio--field":"show_poll_custom_input","click .forminator-popup-close":"close_popup","click .forminator-retry-import":"ajax_cf7_import","change #forminator-choose-import-form":"import_form_action","change .forminator-import-forms":"import_form_action"},initialize:function(t){return t=_.extend({action:"",nonce:"",data:"",id:"",enable_loader:!0},t),this.action=t.action,this.nonce=t.nonce,this.data=t.data,this.id=t.id,this.enable_loader=t.enable_loader,this.render()},render:function(){var n=this,e={};if(e.action="forminator_load_"+this.action+"_popup",e._ajax_nonce=this.nonce,e.data=this.data,this.id&&(e.id=this.id),this.enable_loader){var i="";"sui-box-body"!==this.className&&(i+='<div class="sui-box-body">'),i+='<p class="fui-loading-dialog" aria-label="Loading content"><i class="sui-icon-loader sui-loading" aria-hidden="true"></i></p>',"sui-box-body"!==this.className&&(i+="</div>"),n.$el.html(i)}t.post({url:Forminator.Data.ajaxUrl,type:"post",data:e}).done(function(t){if(t&&t.success){n.$el.html(t.data),n.$el.find(".wpmudev-hidden-popup").show(400),Forminator.Utils.sui_delegate_events();n.$el.find(".forminator-custom-form");n.delegateEvents()}}).always(function(){n.$el.find(".fui-loading-dialog").remove()})},save:function(n){n.preventDefault();var e={},i=t(n.target).data("nonce");e.action="forminator_save_"+this.action+"_popup",e._ajax_nonce=i,t(".wpmudev-popup-form input, .wpmudev-popup-form select").each(function(){var n=t(this);e[n.attr("name")]=n.val()}),t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:e,success:function(t){Forminator.Popup.close(!1,function(){window.location.reload()})}})},ajax_save:function(n){var e=this;n.preventDefault();var i={},o=t(n.target).data("nonce");i.action="forminator_save_"+this.action+"_popup",i._ajax_nonce=o,t(".wpmudev-popup-form input, .wpmudev-popup-form select, .wpmudev-popup-form textarea").each(function(){var n=t(this);("checkbox"!==n[0].type||"checkbox"===n[0].type&&n[0].checked)&&(i[n.attr("name")]=n.val())}),this.$el.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload"),t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:i,success:function(t){if(!0===t.success){var n=!1;_.isUndefined(t.data.url)||(n=t.data.url),Forminator.Popup.close(!1,function(){n&&(location.href=n)})}else{const e="<p>"+t.data+"</p>",i={type:"error",autoclose:{timeout:8e3}};_.isUndefined(t.data)||SUI.openNotice("wpmudev-ajax-error-placeholder",e,i)}}}).always(function(){e.$el.find(".sui-button:not(.disable-loader)").removeClass("sui-button-onload")})},clear_exports:function(n){n.preventDefault();var e={},i=this,o=t(n.target).data("nonce"),a=t(n.target).data("form-id");e.action="forminator_clear_"+this.action+"_popup",e._ajax_nonce=o,e.id=a,t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:e,success:function(){i.render()}})},show_poll_custom_input:function(n){var e=this,i=this.$el.find(".forminator-input"),o=n.target.checked,a=t(n.target).attr("id");if(i.hide(),e.$el.find(".forminator-input#"+a+"-extra").length){var r=e.$el.find(".forminator-input#"+a+"-extra");o?r.show():r.hide()}},ajax_cf7_import:function(n){var e=this,i=e.$el.find("form").serializeArray();n.preventDefault(),this.$el.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload"),this.$el.find(".wpmudev-ajax-error-placeholder").addClass("sui-hidden"),this.$el.find(".forminator-cf7-imported-fail").addClass("sui-hidden"),t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:i,xhr:function(){var t=new window.XMLHttpRequest;return t.upload.addEventListener("progress",function(t){if(t.lengthComputable){var n=t.loaded/t.total;n=parseInt(100*n),e.$el.find(".forminator-cf7-importing .sui-progress-text").html(n+"%"),e.$el.find(".forminator-cf7-importing .sui-progress-bar span").css("width",n+"%")}},!1),t},success:function(t){!0===t.success?setTimeout(function(){e.$el.find(".forminator-cf7-importing").addClass("sui-hidden"),e.$el.find(".forminator-cf7-imported").removeClass("sui-hidden")},1e3):_.isUndefined(t.data)||(setTimeout(function(){e.$el.find(".forminator-cf7-importing").addClass("sui-hidden"),e.$el.find(".forminator-cf7-imported-fail").removeClass("sui-hidden")},1e3),e.$el.find(".wpmudev-ajax-error-placeholder").removeClass("sui-hidden").find("p").text(t.data))}}).always(function(t){e.$el.find(".sui-button:not(.disable-loader)").removeClass("sui-button-onload"),e.$el.find(".forminator-cf7-import").addClass("sui-hidden"),e.$el.find(".forminator-cf7-importing").removeClass("sui-hidden")})},close_popup:function(){Forminator.Popup.close()},import_form_action:function(n){n.preventDefault();var e=t(n.target),i=e.val(),o=!1;"specific"===i&&(o=!0),(null==i||Array.isArray(i)&&i.length<1)&&(o=!0),this.$el.find(".wpmudev-action-ajax-cf7-import").prop("disabled",o)}})})}(jQuery),function(t){formintorjs.define("admin/popup/delete",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-delete-popup-tpl").html()),popupPollTpl:Forminator.Utils.template(t(n).find("#forminator-delete-poll-popup-tpl").html()),initialize:function(t){this.module=t.module,this.nonce=t.nonce,this.id=t.id,this.action=t.action,this.referrer=t.referrer,this.button=t.button||Forminator.l10n.popup.delete,this.content=t.content||Forminator.l10n.popup.cannot_be_reverted},render:function(){"poll"===this.module?this.$el.html(this.popupPollTpl({nonce:this.nonce,id:this.id,referrer:this.referrer,content:this.content})):this.$el.html(this.popupTpl({nonce:this.nonce,id:this.id,action:this.action,referrer:this.referrer,button:this.button,content:this.content}))}})})}(jQuery),function(t){formintorjs.define("admin/popup/preview",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"sui-box-body",initialize:function(n){var e=this,i={action:"",type:"",id:"",preview_data:{},enable_loader:!0};return"forminator_quizzes"===n.type&&(i.has_lead=n.has_lead,i.leads_id=n.leads_id),n=_.extend(i,n),this.action=n.action,this.type=n.type,this.nonce=n.nonce,this.id=n.id,this.render_id=0,this.preview_data=n.preview_data,this.enable_loader=n.enable_loader,"forminator_quizzes"===n.type&&(this.has_lead=n.has_lead,this.leads_id=n.leads_id),t(document).off("after.load.forminator"),t(document).on("after.load.forminator",function(t){e.after_load()}),this.render()},render:function(){var n=this,e={};if(e.action=this.action,e.type=this.type,e.id=this.id,e.render_id=this.render_id,e.nonce=this.nonce,e.is_preview=1,e.preview_data=this.preview_data,e.last_submit_data={},"forminator_quizzes"===this.type&&(e.has_lead=this.has_lead,e.leads_id=this.leads_id),this.enable_loader){var i="";"sui-box-body"!==this.className&&(i+='<div class="sui-box-body">'),i+='<div class="fui-loading-dialog"><p style="margin: 0; text-align: center;" aria-hidden="true"><span class="sui-icon-loader sui-md sui-loading"></span></p><p class="sui-screen-reader-text">Loading content...</p></div>',"sui-box-body"!==this.className&&(i+="</div>"),n.$el.html(i)}var o=t('<form id="forminator-module-'+this.id+'" data-forminator-render="'+this.render_id+'" style="display:none"></form>');n.$el.append(o),t(n.$el.find("#forminator-module-"+this.id+'[data-forminator-render="'+this.render_id+'"]').get(0)).forminatorLoader(e)},after_load:function(){var t=this;t.$el.find('div[data-form="forminator-module-'+this.id+'"]').remove(),t.$el.find(".fui-loading-dialog").remove()}})})}(jQuery),function(t){formintorjs.define("admin/popup/reset-plugin-settings",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-reset-plugin-settings-popup-tpl").html()),events:{"click .popup-confirmation-confirm":"confirm_action"},initialize:function(t){this.nonce=t.nonce,this.referrer=t.referrer,this.content=t.content||Forminator.l10n.popup.cannot_be_reverted},render:function(){this.$el.html(this.popupTpl({nonce:this.nonce,id:this.id,referrer:this.referrer,content:this.content}))},confirm_action:function(n){t(n.currentTarget).addClass("sui-button-onload")}})})}(jQuery),function(t){formintorjs.define("admin/popup/disconnect-stripe",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup delete-stripe--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-disconnect-stripe-popup-tpl").html()),initialize:function(t){this.nonce=t.nonce,this.referrer=t.referrer,this.content=t.content||Forminator.l10n.popup.cannot_be_reverted},render:function(){this.$el.html(this.popupTpl({nonce:this.nonce,id:this.id,referrer:this.referrer,content:Forminator.Utils.sanitize_text_field(this.content)}))}})})}(jQuery),function(t){formintorjs.define("admin/popup/disconnect-paypal",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-disconnect-paypal-popup-tpl").html()),initialize:function(t){this.nonce=t.nonce,this.referrer=t.referrer,this.content=t.content||Forminator.l10n.popup.cannot_be_reverted},render:function(){this.$el.html(this.popupTpl({nonce:this.nonce,id:this.id,referrer:this.referrer,content:Forminator.Utils.sanitize_text_field(this.content)}))}})})}(jQuery),function(t){formintorjs.define("admin/popup/approve-user",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-approve-user-popup-tpl").html()),events:{"click .approve-user.popup-confirmation-confirm":"approveUser"},initialize:function(t){this.nonce=t.nonce,this.referrer=t.referrer,this.content=t.content||Forminator.l10n.popup.cannot_be_reverted,this.activationKey=t.activationKey},render:function(){this.$el.html(this.popupTpl({nonce:this.nonce,id:this.id,referrer:this.referrer,content:this.content,activationKey:this.activationKey}))},submitForm:function(n,e,i){var o={};o.action="forminator_approve_user_popup",o._ajax_nonce=e,o.activation_key=i;var a=n.serialize()+"&"+t.param(o);t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:a,beforeSend:function(){n.find(".sui-button").addClass("sui-button-onload")},success:function(t){t&&t.success?(Forminator.Notification.open("success",Forminator.l10n.commons.approve_user_successfull,4e3),window.location.reload()):Forminator.Notification.open("error",t.data,4e3)},error:function(t){Forminator.Notification.open("error",Forminator.l10n.commons.approve_user_unsuccessfull,4e3)}}).always(function(){n.find(".sui-button").removeClass("sui-button-onload")})},approveUser:function(n){n.preventDefault(),t(n.target).addClass("sui-button-onload");var e=this.$el.find(".form-approve-user"),i=e.find("form");return this.submitForm(i,this.nonce,this.activationKey),!1}})})}(jQuery),function(t){formintorjs.define("admin/popup/delete-unconfirmed-user",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-delete-unconfirmed-user-popup-tpl").html()),events:{"click .delete-unconfirmed-user.popup-confirmation-confirm":"deleteUnconfirmedUser"},initialize:function(t){this.nonce=t.nonce,this.formId=t.formId,this.referrer=t.referrer,this.content=t.content||Forminator.l10n.popup.cannot_be_reverted,this.activationKey=t.activationKey,this.entryId=t.entryId},render:function(){this.$el.html(this.popupTpl({nonce:this.nonce,formId:this.formId,referrer:this.referrer,content:this.content,activationKey:this.activationKey,entryId:this.entryId}))},submitForm:function(n,e,i,o,a){var r={action:"forminator_delete_unconfirmed_user_popup",_ajax_nonce:e,activation_key:i,form_id:o,entry_id:a},s=n.serialize()+"&"+t.param(r);t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:s,beforeSend:function(){n.find(".sui-button").addClass("sui-button-onload")},success:function(t){t&&t.success?window.location.reload():Forminator.Notification.open("error",t.data,4e3)},error:function(t){Forminator.Notification.open("error",t.data,4e3)}}).always(function(){n.find(".sui-button").removeClass("sui-button-onload")})},deleteUnconfirmedUser:function(n){n.preventDefault(),t(n.target).addClass("sui-button-onload");var e=this.$el.find(".form-delete-unconfirmed-user"),i=e.find("form");return this.submitForm(i,this.nonce,this.activationKey,this.formId,this.entryId),!1}})})}(jQuery),function(t){formintorjs.define("admin/popup/create-appearance-preset",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-create-appearance-preset-tpl").html()),events:{"click #forminator-create-preset":"createPreset","keydown #forminator-preset-name":"toggleButton"},initialize:function(t){this.nonce=t.nonce,this.title=t.title,this.content=t.content,this.$target=t.$target},render:function(){var t=this.$target.data("modal-preset-form-label"),n=this.$target.data("modal-preset-loading-text"),e=this.$target.data("modal-preset-name-label"),i=this.$target.data("modal-preset-name-placeholder");this.$el.html(this.popupTpl({title:Forminator.Utils.sanitize_text_field(this.title),content:Forminator.Utils.sanitize_text_field(this.content),formLabel:Forminator.Utils.sanitize_text_field(t),loadingText:Forminator.Utils.sanitize_text_field(n),nameLabel:Forminator.Utils.sanitize_text_field(e),namePlaceholder:Forminator.Utils.sanitize_text_field(i)}))},toggleButton:function(n){setTimeout(function(){var e=t(n.currentTarget).val().trim();t("#forminator-create-preset").prop("disabled",!e)},300)},createPreset:function(n){n.preventDefault(),n.stopImmediatePropagation();var e=t(n.target);e.addClass("sui-button-onload-text");var i=this.$el.find('select[name="form_id"]').val(),o=this.$el.find("#forminator-preset-name").val(),a={action:"forminator_create_appearance_preset",_ajax_nonce:this.nonce,form_id:i,name:o};return t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:a,success:function(t){t&&t.success?Forminator.openPreset(t.data):(Forminator.Notification.open("error",t.data,4e3),e.removeClass("sui-button-onload-text"))},error:function(t){Forminator.Notification.open("error",t.data,4e3),e.removeClass("sui-button-onload-text")}}),!1}})})}(jQuery),function(t){formintorjs.define("admin/popup/apply-appearance-preset",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-apply-appearance-preset-tpl").html()),events:{"click #forminator-apply-preset":"applyPreset"},initialize:function(t){this.$target=t.$target},render:function(){this.$el.html(this.popupTpl({description:Forminator.Data.modules.ApplyPreset.description,notice:Forminator.Data.modules.ApplyPreset.notice,button:Forminator.Data.modules.ApplyPreset.button,selectbox:Forminator.Data.modules.ApplyPreset.selectbox}))},applyPreset:function(n){n.preventDefault(),n.stopImmediatePropagation();var e=t(n.target);e.addClass("sui-button-onload-text");var i=this.$target.data("form-id"),o=[],a=this.$el.find('select[name="appearance_preset"]').val();o=i?[i]:t("#forminator_bulk_ids").val().split(",");var r={action:"forminator_apply_appearance_preset",_ajax_nonce:Forminator.Data.modules.ApplyPreset.nonce,preset_id:a,ids:o};return t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:r,success:function(t){t&&t.success?(Forminator.Notification.open("success",t.data,4e3),Forminator.Popup.close()):(Forminator.Notification.open("error",t.data,4e3),e.removeClass("sui-button-onload-text"))},error:function(t){Forminator.Notification.open("error",t.data,4e3),e.removeClass("sui-button-onload-text")}}),!1}})})}(jQuery),function(t){formintorjs.define("admin/popup/confirm",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-confirmation-popup-tpl").html()),default_options:{confirmation_message:Forminator.l10n.popup.confirm_action,confirmation_title:Forminator.l10n.popup.confirm_title,confirm_callback:function(){this.close()},cancel_callback:function(){this.close()}},confirm_options:{},events:{"click .popup-confirmation-confirm":"confirm_action","click .popup-confirmation-cancel":"cancel_action"},initialize:function(t){this.confirm_options=_.defaults(t,this.default_options)},render:function(){return this.$el.html(this.popupTpl(this.confirm_options)),this},confirm_action:function(){this.confirm_options.confirm_callback.apply(this,[])},cancel_action:function(){this.confirm_options.cancel_callback.apply(this,[])},close:function(){Forminator.Popup.close()}})})}(jQuery),function(t){formintorjs.define("admin/popup/addons-actions",["text!tpl/dashboard.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--popup",popupTpl:Forminator.Utils.template(t(n).find("#forminator-addons-action-popup-tpl").html()),initialize:function(t){this.nonce=t.nonce,this.is_network=t.is_network,this.id=t.id,this.referrer=t.referrer,this.content=t.content||Forminator.l10n.popup.cannot_be_reverted,this.forms=t.forms||[]},render:function(){this.$el.html(this.popupTpl({nonce:this.nonce,is_network:this.is_network,id:this.id,referrer:this.referrer,content:this.content,forms:this.forms}))}})})}(jQuery),formintorjs.define("text!tpl/reports.html",[],function(){
    16 return'<div>\n    <script type="text/template" id="forminator-add-reports-content">\n        <div\n            id="forminator-notifications-slide-settings"\n            class="sui-modal-slide sui-active sui-loaded"\n            data-modal-size="lg"\n        >\n            <div class="sui-box">\n                <div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\n                    <button class="sui-button-icon sui-button-float--right forminator-popup-close">\n                        <span class="sui-icon-close" aria-hidden="true"></span>\n                        <span class="sui-screen-reader-text">Close</span>\n                    </button>\n                    <h3 id="forminator-settings__title" class="sui-box-title sui-lg">\n                        {{ Forminator.l10n.popup.settings_label }}\n                    </h3>\n                    <p id="forminator-settings__description" class="sui-description">\n                        {{ Forminator.l10n.popup.settings_description }}\n                    </p>\n                </div>\n                <div class="sui-box-body reports-settings-content"></div>\n\n                <div class="sui-box-footer sui-content-separated">\n                    <button class="sui-button sui-button-ghost forminator-cancel-report">\n                        <span class="sui-loading-text">{{ Forminator.l10n.popup.cancel }}</span>\n                        <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                    </button>\n                    <button\n                            id="forminator-notifications-slide-settings-next"\n                            class="sui-button forminator-popup-slide"\n                            data-modal-slide="forminator-notifications-slide-schedule"\n                            data-modal-slide-focus=""\n                            data-modal-slide-intro="next"\n                    >\n                        <span class="sui-loading-text">{{ Forminator.l10n.form.continue_button }}</span>\n                    </button>\n                </div>\n            </div>\n        </div>\n        <div\n            id="forminator-notifications-slide-schedule"\n            class="sui-modal-slide"\n            data-modal-size="lg"\n            aria-hidden="true"\n            tabindex="-1"\n        >\n            <div class="sui-box">\n                <div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\n                    <button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\n                        <span class="sui-icon-close sui-md" aria-hidden="true"></span>\n                        <span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\n                    </button>\n\n                    <h3 id="forminator-schedule__title" class="sui-box-title sui-lg">\n                        {{ Forminator.l10n.popup.schedule_label }}\n                    </h3>\n\n                    <p id="forminator-schedule__description" class="sui-description">\n                        {{ Forminator.l10n.popup.schedule_description }}\n                    </p>\n\n                </div>\n\n                <div class="sui-box-body reports-schedule-content"></div>\n                <div class="sui-box-footer sui-content-separated">\n\n                    <button id="forminator-notifications-slide-schedule-back"\n                            class="forminator-popup-slide sui-button sui-button-ghost"\n                            data-modal-slide="forminator-notifications-slide-settings"\n                            data-modal-slide-focus=""\n                            data-modal-slide-intro="back">\n                        <span class="sui-loading-text">{{ Forminator.l10n.popup.back }}</span>\n                        <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                    </button>\n                    <button id="forminator-notifications-slide-schedule-next"\n                            class="sui-button forminator-popup-slide"\n                            data-modal-slide="forminator-notifications-slide-recipients"\n                            data-modal-slide-focus=""\n                            data-modal-slide-intro="next">\n                        <span class="sui-loading-text">{{ Forminator.l10n.quiz.continue_button }}</span>\n                        <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                    </button>\n                </div>\n            </div>\n        </div>\n\n        <div\n                id="forminator-notifications-slide-recipients"\n                class="sui-modal-slide"\n                data-modal-size="lg"\n                aria-hidden="true"\n                tabindex="-1"\n        >\n            <div class="sui-box">\n                <div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\n                    <button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\n                        <span class="sui-icon-close sui-md" aria-hidden="true"></span>\n                        <span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\n                    </button>\n                    <h3 id="forminator-popup__title" class="sui-box-title sui-lg">\n                        {{ Forminator.l10n.popup.recipients_label }}\n                    </h3>\n                    <p id="forminator-popup__description" class="sui-description">\n                        {{ Forminator.l10n.popup.recipients_description }}\n                    </p>\n                </div>\n                <div class="sui-box-body reports-recipients-content"></div>\n                <div class="sui-box-footer sui-content-separated">\n                    <button id="forminator-notifications-slide-recipients-back"\n                            class="forminator-popup-slide sui-button sui-button-ghost"\n                            data-modal-slide="forminator-notifications-slide-schedule"\n                            data-modal-slide-focus=""\n                            data-modal-slide-intro="back">\n                        <span class="sui-loading-text">{{ Forminator.l10n.popup.back }}</span>\n                        <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                    </button>\n                    <div class="report-button-with-toggle">\n                        <label for="notification-status-slide" class="sui-toggle">\n                            <input type="checkbox" id="notification-status-slide" class="notification-save-status"\n                                   aria-labelledby="notification-status-slide-label"\n                                   {{ \'active\' === notification.report_status ? \'checked="checked"\' : \'\' }}>\n                            <span class="sui-toggle-slider" aria-hidden="true"></span>\n                            <span id="notification-status-slide-label" class="sui-toggle-label">\n                                {{ Forminator.l10n.popup.status_label }}\n                            </span>\n                        </label>\n                        <button class="sui-button forminator-report-save sui-button-blue" data-id="0">\n                            <span class="sui-loading-text">{{ Forminator.l10n.popup.save_changes }}</span>\n                            <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                        </button>\n                    </div>\n                </div>\n            </div>\n        </div>\n    <\/script>\n    <script type="text/template" id="forminator-reports-settings-content">\n        <div>\n            <div class="sui-box-settings-row">\n                <div class="sui-box-settings-col-2">\n                    <div class="sui-form-field">\n                        <label for="report-title"\n                               id="label-report-title" class="sui-label">\n                            {{ Forminator.l10n.commons.label }}\n                        </label>\n                        <input\n                                placeholder="Placeholder"\n                                id="report-title"\n                                name="label"\n                                value="{{ settings.label }}"\n                                class="sui-form-control"\n                                aria-labelledby="label-report-title"\n                                aria-describedby="error-report-title description-report-title"\n                        />\n                        <span id="description-report-title" class="sui-description">\n                            {{ Forminator.l10n.popup.label_description }}\n                        </span>\n                    </div>\n                </div>\n            </div>\n            <div class="sui-box-settings-row">\n                <div class="sui-box-settings-col-2">\n                    <label class="sui-settings-label">\n                        {{ Forminator.l10n.commons.module }}\n                    </label>\n                    <span class="sui-description">\n                       {{ Forminator.l10n.popup.module_description }}\n                    </span>\n                    <div class="sui-form-field">\n                        <div class="sui-side-tabs">\n                            <div class="sui-tabs-menu">\n                                <label for="module_forms" class="sui-tab-item {{ \'forms\' === settings.module ? \'active\' : \'\' }}">\n                                    <input type="radio"\n                                           name="module"\n                                           id="module_forms"\n                                           value="forms"\n                                           aria-controls="module_forms__content"\n                                           data-tab-menu="report-module">\n                                    {{ Forminator.l10n.popup.forms }}\n                                </label>\n                                <label for="module_quizzes" class="sui-tab-item {{ \'quizzes\' === settings.module ? \'active\' : \'\' }}">\n                                    <input type="radio"\n                                           name="module"\n                                           id="module_quizzes"\n                                           value="quizzes"\n                                           aria-controls="module_quizzes__content"\n                                           data-tab-menu="report-module">\n                                    {{ Forminator.l10n.popup.quizzes }}\n                                </label>\n                                <label for="module_polls" class="sui-tab-item {{ \'polls\' === settings.module ? \'active\' : \'\' }}">\n                                    <input type="radio"\n                                           name="module"\n                                           id="module_polls"\n                                           value="polls"\n                                           aria-controls="module_polls__content"\n                                           data-tab-menu="report-module">\n                                    {{ Forminator.l10n.popup.polls }}\n                                </label>\n                            </div>\n    \n                            <div class="sui-tabs-content">\n    \n                                <div role="tabpanel" id="module_forms__content"\n                                     class="sui-tab-content {{ \'forms\' === settings.module ? \'active\' : \'\' }}"\n                                     aria-labelledby="module_forms__tab" tabindex="0"\n                                     data-tab-content="report-module">\n                                    <div class="sui-border-frame">\n                                        <label class="sui-settings-label sui-sm">\n                                            {{ Forminator.l10n.popup.select_forms }}\n                                        </label>\n    \n                                        <span class="sui-description">\n                                            {{ Forminator.l10n.popup.select_forms_description }}\n                                        </span>\n    \n                                        <div class="sui-form-field">\n    \n                                            <div class="sui-side-tabs">\n                                                <div class="sui-tabs-menu">\n                                                    <label for="all_forms" class="sui-tab-item {{ undefined === settings.forms_type || \'all\' === settings.forms_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="forms_type"\n                                                               id="all_forms"\n                                                               value="all"\n                                                               aria-controls="all_forms__content"\n                                                               data-tab-menu="select-form">\n                                                        {{ Forminator.l10n.popup.all_forms }}\n                                                    </label>\n                                                    <label for="selected_forms" class="sui-tab-item {{ \'selected\' === settings.forms_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="forms_type"\n                                                               id="selected_forms"\n                                                               value="selected"\n                                                               aria-controls="selected_forms__content"\n                                                               data-tab-menu="select-form">\n                                                        {{ Forminator.l10n.popup.selected_forms }}\n                                                    </label>\n                                                </div>\n    \n                                                <div class="sui-tabs-content">\n    \n                                                    <div role="tabpanel" id="selected_forms__content"\n                                                         class="sui-tab-content {{ \'selected\' === settings.forms_type ? \'active\' : \'\' }}"\n                                                         aria-labelledby="selected_forms" tabindex="0" hidden\n                                                         data-tab-content="select-form">\n                                                        <div class="sui-border-frame">\n                                                            <div class="sui-form-field">\n                                                                <label class="sui-label">\n                                                                    {{ Forminator.l10n.popup.select_forms }}\n                                                                </label>\n    \n                                                                <select name="select_forms" class="sui-select" multiple>\n                                                                    {[ let selected_form = settings.selected_forms;\n                                                                    _.each(Forminator.Data.form_modules, function(forms){ ]}\n                                                                        <option value="{{ forms.id }}"\n                                                                            {[ if( undefined !== selected_form && selected_form.indexOf(forms.id.toString()) !== -1 ) { ]}\n                                                                                selected="selected"\n                                                                            {[ } ]}>\n                                                                            {{ forms.name }}\n                                                                        </option>\n                                                                    {[ }); ]}\n                                                                </select>\n    \n                                                                <p id="selected-forms-description" class="sui-description">\n                                                                    {{ Forminator.l10n.popup.selected_forms_description }}\n                                                                </p>\n                                                            </div>\n                                                        </div>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                </div>\n    \n                                <div role="tabpanel" id="module_quizzes__content"\n                                     class="sui-tab-content {{ \'quizzes\' === settings.module ? \'active\' : \'\' }}"\n                                     aria-labelledby="module_quizzes__tab" tabindex="0" hidden\n                                     data-tab-content="report-module">\n                                    <div class="sui-border-frame">\n                                        <label class="sui-settings-label sui-sm">\n                                            {{ Forminator.l10n.popup.select_quizzes }}\n                                        </label>\n    \n                                        <span class="sui-description">\n                                            {{ Forminator.l10n.popup.select_quizzes_description }}\n                                        </span>\n    \n                                        <div class="sui-form-field">\n    \n                                            <div class="sui-side-tabs">\n                                                <div class="sui-tabs-menu">\n                                                    <label for="all_quizzes" class="sui-tab-item {{ undefined === settings.quizzes_type || \'all\' === settings.quizzes_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="quizzes_type"\n                                                               id="all_quizzes"\n                                                               value="all"\n                                                               aria-controls="all_quizzes__content"\n                                                               data-tab-menu="select-quiz">\n                                                        {{ Forminator.l10n.popup.all_quizzes }}\n                                                    </label>\n                                                    <label for="selected_quizzes" class="sui-tab-item {{ \'selected\' === settings.quizzes_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="quizzes_type"\n                                                               id="selected_quizzes"\n                                                               value="selected"\n                                                               aria-controls="selected_quizzes__content"\n                                                               data-tab-menu="select-quiz">\n                                                        {{ Forminator.l10n.popup.selected_quizzes }}\n                                                    </label>\n                                                </div>\n    \n                                                <div class="sui-tabs-content">\n    \n                                                    <div role="tabpanel" id="selected_quizzes__content"\n                                                         class="sui-tab-content {{ \'selected\' === settings.quizzes_type ? \'active\' : \'\' }}"\n                                                         aria-labelledby="selected_quizzes__tab" tabindex="0" hidden\n                                                         data-tab-content="select-quiz">\n                                                        <div class="sui-border-frame">\n                                                            <div class="sui-form-field">\n                                                                <label class="sui-label">\n                                                                    {{ Forminator.l10n.popup.select_quizzes }}\n                                                                </label>\n    \n                                                                <select name="select_quizzes" class="sui-select" multiple>\n                                                                    {[ let selected_quiz = settings.selected_quizzes;\n                                                                    _.each(Forminator.Data.quiz_modules, function(quizzes){ ]}\n                                                                        <option value="{{ quizzes.id }}"\n                                                                        {[ if( undefined !== selected_quiz && selected_quiz.indexOf(quizzes.id.toString()) !== -1 ) { ]}selected="selected"{[ } ]}>\n                                                                            {{ quizzes.name }}\n                                                                        </option>\n                                                                    {[ }); ]}\n                                                                </select>\n    \n                                                                <p id="selected-quizzes-description" class="sui-description">\n                                                                    {{ Forminator.l10n.popup.selected_quizzes_description }}\n                                                                </p>\n                                                            </div>\n                                                        </div>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                </div>\n    \n                                <div role="tabpanel" id="module_polls__content"\n                                     class="sui-tab-content {{ \'polls\' === settings.module ? \'active\' : \'\' }}"\n                                     aria-labelledby="module_polls__tab" tabindex="0" hidden\n                                     data-tab-content="report-module">\n                                    <div class="sui-border-frame">\n                                        <label class="sui-settings-label sui-sm">\n                                            {{ Forminator.l10n.popup.select_polls }}\n                                        </label>\n    \n                                        <span class="sui-description">\n                                            {{ Forminator.l10n.popup.select_polls_description }}\n                                        </span>\n    \n                                        <div class="sui-form-field">\n    \n                                            <div class="sui-side-tabs">\n                                                <div class="sui-tabs-menu">\n                                                    <label for="all_polls" class="sui-tab-item {{ undefined === settings.polls_type || \'all\' === settings.polls_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="polls_type"\n                                                               id="all_polls"\n                                                               value="all"\n                                                               aria-controls="all_polls__content"\n                                                               data-tab-menu="select-poll">\n                                                        {{ Forminator.l10n.popup.all_polls }}\n                                                    </label>\n                                                    <label for="all_polls" class="sui-tab-item {{ \'selected\' === settings.polls_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="polls_type"\n                                                               id="selected_polls"\n                                                               value="selected"\n                                                               aria-controls="selected_polls__content"\n                                                               data-tab-menu="select-quiz">\n                                                        {{ Forminator.l10n.popup.selected_polls }}\n                                                    </label>\n                                                </div>\n    \n                                                <div class="sui-tabs-content">\n    \n                                                    <div role="tabpanel" id="selected_polls__content"\n                                                         class="sui-tab-content {{ \'selected\' === settings.polls_type ? \'active\' : \'\' }}"\n                                                         aria-labelledby="selected_polls__tab" tabindex="0" hidden\n                                                         data-tab-content="select-quiz">\n                                                        <div class="sui-border-frame">\n                                                            <div class="sui-form-field">\n                                                                <label class="sui-label">\n                                                                    {{ Forminator.l10n.popup.select_polls }}\n                                                                </label>\n    \n                                                                <select name="select_polls" class="sui-select" multiple>\n                                                                    {[ let selected_polls = settings.selected_polls;\n                                                                    _.each(Forminator.Data.poll_modules, function(polls){ ]}\n                                                                        <option value="{{ polls.id }}"\n                                                                         {[ if( undefined !== selected_polls && selected_polls.indexOf(polls.id.toString()) !== -1 ) { ]}selected="selected"{[ } ]}>\n                                                                            {{ polls.name }}\n                                                                        </option>\n                                                                    {[ }); ]}\n                                                                </select>\n    \n                                                                <p id="selected-poll-description" class="sui-description">\n                                                                    {{ Forminator.l10n.popup.selected_polls_description }}\n                                                                </p>\n                                                            </div>\n                                                        </div>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    <\/script>\n    <script type="text/template" id="forminator-reports-schedule-content">\n        <div class="sui-box-settings-row">\n\n            <div class="sui-box-settings-col-2">\n                <div class="sui-side-tabs">\n                    <div class="sui-tabs-menu">\n                        <label for="frequency_daily" class="sui-tab-item {{ \'daily\' === schedule.frequency ? \'active\' : \'\' }}">\n                            <input type="radio"\n                                   id="frequency_daily"\n                                   name="frequency"\n                                   aria-controls="frequency_daily__content"\n                                   value="daily"\n                                   data-tab-menu="report-frequency">\n                            {{ Forminator.l10n.popup.daily }}\n                        </label>\n                        <label for="frequency_weekly" class="sui-tab-item {{ \'weekly\' === schedule.frequency ? \'active\' : \'\' }}">\n                            <input type="radio"\n                                   name="frequency"\n                                   id="frequency_weekly"\n                                   aria-controls="frequency_weekly__content"\n                                   value="weekly"\n                                   data-tab-menu="report-frequency">\n                            {{ Forminator.l10n.popup.weekly }}\n                        </label>\n                        <label for="frequency_monthly" class="sui-tab-item {{ \'monthly\' === schedule.frequency ? \'active\' : \'\' }}">\n                            <input type="radio"\n                                   name="frequency"\n                                   id="frequency_monthly"\n                                   aria-controls="frequency_monthly__content"\n                                   value="monthly"\n                                   data-tab-menu="report-frequency">\n                            {{ Forminator.l10n.popup.monthly }}\n                        </label>\n                    </div>\n\n                    <div class="sui-tabs-content">\n\n                        <div role="tabpanel" id="frequency_daily__content" class="sui-tab-content\n                            {{ \'daily\' === schedule.frequency ? \'active\' : \'\' }}"\n                             aria-labelledby="frequency_daily__tab" tabindex="0"\n                             data-tab-content="report-frequency">\n                            <div class="sui-border-frame">\n                                <div class="sui-form-field sui-no-margin-bottom">\n                                    <label class="sui-label" for="report-time">\n                                        {{ Forminator.l10n.popup.day_time }}\n                                    </label>\n                                    <select name="report-time" id="report-time" class="sui-select">\n                                        {[ _.each(Forminator.l10n.popup.time_interval, function(interval){ ]}\n                                        <option value="{{ interval }}"\n                                            {[ if( undefined !== schedule.time && schedule.time === interval ) { ]}\n                                                selected="selected"\n                                            {[ } ]}\n                                        >{{ interval }}</option>\n                                        {[ }); ]}\n                                    </select>\n                                    <p id="select-single-frequency_time" class="sui-description">\n                                        {{ Forminator.l10n.popup.frequency_time }}\n                                    </p>\n                                </div>\n                            </div>\n                        </div>\n\n                        <div role="tabpanel" id="frequency_weekly__content" class="sui-tab-content\n                            {{ \'weekly\' === schedule.frequency ? \'active\' : \'\' }}"\n                             aria-labelledby="frequency_weekly__tab" tabindex="0" hidden\n                             data-tab-content="report-frequency">\n                            <div class="sui-border-frame">\n                                <div class="sui-row sui-no-margin-bottom schedule-box">\n                                    <div class="sui-col sui-form-field sui-no-margin-bottom">\n                                        <label class="sui-label" for="week-days">\n                                            {{ Forminator.l10n.popup.week_day }}\n                                        </label>\n                                        <select name="week-days" class="sui-select" id="week-days">\n                                            {[ _.each(Forminator.l10n.popup.week_days, function(week, days){ ]}\n                                            <option value="{{ days }}"\n                                                {[ if( undefined !== schedule.weekDay && schedule.weekDay === days ) { ]}\n                                                    selected="selected"\n                                                {[ } ]}\n                                            >{{ week }}</option>\n                                            {[ }); ]}\n                                        </select>\n                                    </div>\n                                    <div class="sui-col sui-form-field sui-no-margin-bottom">\n                                        <label class="sui-label" for="week-time">\n                                            {{ Forminator.l10n.popup.day_time }}\n                                        </label>\n                                        <select name="week-time" class="sui-select" id="week-time">\n                                            {[ _.each(Forminator.l10n.popup.time_interval, function(interval){ ]}\n                                            <option value="{{ interval }}"\n                                                {[ if( undefined !== schedule.weekTime && schedule.weekTime === interval ) { ]}\n                                                    selected="selected"\n                                                {[ } ]}\n                                            >{{ interval }}</option>\n                                            {[ }); ]}\n                                        </select>\n                                    </div>\n                                    <p id="select-single-default-helper" class="sui-col-12 sui-description">\n                                        {{ Forminator.l10n.popup.frequency_time }}\n                                    </p>\n                                </div>\n                            </div>\n                        </div>\n\n                        <div role="tabpanel" id="frequency_monthly__content" class="sui-tab-content\n                            {{ \'monthly\' === schedule.frequency ? \'active\' : \'\' }}"\n                             aria-labelledby="frequency_monthly__tab" tabindex="0" hidden\n                             data-tab-content="report-frequency">\n                            <div class="sui-border-frame">\n                                <div class="sui-row sui-no-margin-bottom schedule-box">\n                                    <div class="sui-col sui-form-field sui-no-margin-bottom">\n                                        <label class="sui-label" for="week-days">\n                                            {{ Forminator.l10n.popup.month_day }}\n                                        </label>\n                                        <select name="month-days" class="sui-select" id="month-days">\n                                            {[ _.each(Forminator.l10n.popup.month_days, function(month){ ]}\n                                            <option value="{{ month }}"\n                                                {[ if( undefined !== schedule.monthDay && schedule.monthDay === month.toString() ) { ]}\n                                                    selected="selected"\n                                                {[ } ]}\n                                            >{{ month }}</option>\n                                            {[ }); ]}\n                                        </select>\n                                    </div>\n                                    <div class="sui-col sui-form-field sui-no-margin-bottom">\n                                        <label class="sui-label" for="week-time">\n                                            {{ Forminator.l10n.popup.day_time }}\n                                        </label>\n                                        <select name="month-time" class="sui-select" id="month-time">\n                                            {[ _.each(Forminator.l10n.popup.time_interval, function(interval){ ]}\n                                            <option value="{{ interval }}"\n                                                {[ if( undefined !== schedule.monthTime && schedule.monthTime === interval ) { ]}\n                                                    selected="selected"\n                                                {[ } ]}\n                                            >{{ interval }}</option>\n                                            {[ }); ]}\n                                        </select>\n                                    </div>\n                                    <p id="select-month-default-helper" class="sui-col-12 sui-description">\n                                        {{ Forminator.l10n.popup.frequency_time }}\n                                    </p>\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    <\/script>\n    <script type="text/template" id="forminator-reports-recipients-content">\n        <div class="sui-box-settings-row">\n            <div class="sui-box-settings-col-2">\n                <div class="sui-tabs sui-tabs-overflow">\n                    <div role="tablist" class="sui-tabs-menu">\n                        <button type="button" role="tab" id="notifications-add-users" class="sui-tab-item active"\n                                aria-controls="notifications-add-users-content" aria-selected="true">\n                            {{ Forminator.l10n.popup.add_users }}\n                        </button>\n                        <button type="button" role="tab" id="notifications-invite-users" class="sui-tab-item"\n                                aria-controls="notifications-invite-users-content" aria-selected="false" tabindex="-1">\n                            {{ Forminator.l10n.popup.add_by_email }}\n                        </button>\n                    </div>\n                    <div class="sui-tabs-content">\n                        <div role="tabpanel" tabindex="0" id="notifications-add-users-content"\n                             class="sui-tab-content active" aria-labelledby="notifications-add-users">\n                            <div class="sui-form-field sui-no-margin-bottom">\n                                <label for="forminator-search-users" class="sui-label">\n                                    {{ Forminator.l10n.popup.search_user }}\n                                </label>\n                                <select id="forminator-search-users" class="sui-select" data-theme="search"\n                                        data-placeholder="{{ Forminator.l10n.popup.search_placeholder }}"\n                                        multiple>\n                                </select>\n                            </div>\n                            {[ const hasUserRecipients = recipients.find( r => undefined !== r.role && \'\' !== r.role ); ]}\n                            <div class="{{ undefined === hasUserRecipients ? \'sui-hidden\' : \'sui-margin-top\' }}">\n                                <strong>{{ Forminator.l10n.popup.added_users }}</strong>\n                                <div class="sui-recipients" id="modal-user-recipients-list">\n                                    {[ for ( const recipient of recipients ) {\n                                    if ( \'\' !== recipient.role ) { ]}\n                                    <div class="sui-recipient sui-recipient-rounded" data-id="{{ recipient.id }}" data-email="{{ recipient.email }}">\n                                        {[ let subClass = \'\';\n                                        if ( \'undefined\' !== typeof recipient.is_pending ) {\n                                        if ( ! recipient.is_pending && \'undefined\' !== typeof recipient.is_subscribed && ! recipient.is_subscribed ) {\n                                        subClass = \'unsubscribed\';\n                                        } else {\n                                        subClass = recipient.is_pending ? \'pending\' : \'confirmed\';\n                                        }\n                                        } ]}\n                                        <span class="sui-recipient-name">\n                                            <span class="subscriber {{ subClass }}">\n                                                {[ if ( \'pending\' === subClass ) { ]}\n                                                <span class="sui-tooltip" data-tooltip="{{ Forminator.l10n.popup.awaiting_confirmation }}">\n                                                {[ } ]}\n                                                    <img src="{{ recipient.avatar }}" alt="{{ recipient.email }}">\n                                                {[ if ( \'pending\' === subClass ) { ]}\n                                                </span>\n                                                 {[ } ]}\n                                            </span>\n                                            <span class="forminator-recipient-name">{{ recipient.name }}</span>\n                                        </span>\n                                        <span class="sui-recipient-email">{{ recipient.role }}</span>\n                                        {[ if ( \'pending\' === subClass || \'unsubscribed\' === subClass ) { ]}\n                                        <button\n                                                type="button"\n                                                class="resend-invite sui-button-icon sui-tooltip"\n                                                data-tooltip="{{ Forminator.l10n.popup.resend_invite }}"\n                                        >\n                                            <span class="sui-icon-send" aria-hidden="true"></span>\n                                        </button>\n                                        {[ } ]}\n                                        <button\n                                                type="button"\n                                                class="sui-button-icon sui-tooltip forminator-remove-recipient"\n                                                data-tooltip="{{ Forminator.l10n.popup.remove_user }}"\n                                                data-id="{{ recipient.id }}"\n                                                data-email="{{ recipient.email }}"\n                                                data-type="user">\n                                            <span class="sui-icon-trash" aria-hidden="true"></span>\n                                        </button>\n                                    </div>\n                                    {[ } ]}\n                                    {[ } ]}\n                                </div>\n                            </div>\n                            <div class="sui-margin-top sui-hidden">\n                                <strong>{{ Forminator.l10n.popup.users }}</strong>\n                                <div class="sui-recipients" id="forminator-user-list"></div>\n                            </div>\n                            <div class="sui-notice sui-notice-warning sui-margin-top notifications-recipients-notice sui-hidden">\n                                <div class="sui-notice-content">\n                                    <div class="sui-notice-message">\n                                        <span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\n                                        <p></p>\n                                    </div>\n                                </div>\n                            </div>\n                        </div>\n                        <div role="tabpanel" tabindex="0" id="notifications-invite-users-content" class="sui-tab-content" aria-labelledby="notifications-invite-users" hidden>\n                            <p class="sui-description">\n                                {{ Forminator.l10n.popup.invite_description }}\n                            </p>\n                            <div class="sui-form-field">\n                                <label for="recipient-name" id="label-recipient-name" class="sui-label">\n                                    {{ Forminator.l10n.popup.first_name }}\n                                </label>\n\n                                <input\n                                        placeholder="{{ Forminator.l10n.popup.name_placeholder }}"\n                                        id="recipient-name"\n                                        class="sui-form-control"\n                                        aria-labelledby="label-recipient-name"\n                                />\n                            </div>\n\n                            <div class="sui-form-field">\n                                <label for="recipient-email" id="label-recipient-email" class="sui-label">\n                                    {{ Forminator.l10n.popup.email_address }}\n                                </label>\n\n                                <input\n                                        placeholder="{{ Forminator.l10n.popup.email_placeholder }}"\n                                        id="recipient-email"\n                                        class="sui-form-control"\n                                        aria-labelledby="label-recipient-email"\n                                />\n                                <span id="error-recipient-email" class="sui-error-message" role="alert"></span>\n                            </div>\n\n                            <div class="sui-form-field sui-no-margin-bottom">\n                                <button type="button" id="add-recipient-button" class="sui-button" aria-live="polite" disabled="disabled">\n                                    <span class="sui-button-text-default">{{ Forminator.l10n.popup.add_recipient }}</span>\n                                    <span class="sui-button-text-onload">\n                                        <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>\n                                        {{ Forminator.l10n.popup.adding_recipient }}\n                                    </span>\n                                </button>\n                            </div>\n\n                            {[ const hasInvitedRecipients = recipients.find( r => undefined === r.role || \'\' === r.role ); ]}\n                            <div class="{{ undefined === hasInvitedRecipients ? \'sui-hidden\' : \'sui-margin-top\' }}">\n                                <strong>{{ Forminator.l10n.popup.added_users }}</strong>\n                                <div class="sui-recipients" id="modal-email-recipients-list">\n                                    {[ for ( const recipient of recipients ) {\n                                    if ( undefined === recipient.role || \'\' === recipient.role ) { ]}\n                                    <div class="sui-recipient sui-recipient-rounded" data-id="{{ recipient.id }}" data-email="{{ recipient.email }}">\n                                        {[ let subClass = \'\';\n                                        if ( \'undefined\' !== typeof recipient.is_pending ) {\n                                        if ( ! recipient.is_pending && \'undefined\' !== typeof recipient.is_subscribed && ! recipient.is_subscribed ) {\n                                        subClass = \'unsubscribed\';\n                                        } else {\n                                        subClass = recipient.is_pending ? \'pending\' : \'confirmed\';\n                                        }\n                                        } ]}\n                                        <span class="sui-recipient-name">\n                                            <span class="subscriber {{ subClass }}">\n                                                {[ if ( \'pending\' === subClass ) { ]}\n                                                    <span class="sui-tooltip" data-tooltip="{{ Forminator.l10n.popup.awaiting_confirmation }}">\n                                                {[ } ]}\n                                                    <img src="{{ recipient.avatar }}" alt="{{ recipient.email }}">\n                                                {[ if ( \'pending\' === subClass ) { ]}\n                                                    </span>\n                                                {[ } ]}\n                                            </span>\n                                            <span>{{ recipient.name }}</span>\n                                        </span>\n                                        <span class="sui-recipient-email">{{ recipient.email }}</span>\n                                        {[ if ( \'pending\' === subClass || \'unsubscribed\' === subClass ) { ]}\n                                        <button\n                                                type="button"\n                                                class="resend-invite sui-button-icon sui-tooltip"\n                                                data-tooltip="{{ Forminator.l10n.popup.resend_invite }}"\n                                                data-name="{{ recipient.name }}"\n                                                data-email="{{ recipient.email }}">\n                                            <span class="sui-icon-send" aria-hidden="true"></span>\n                                        </button>\n                                        {[ } ]}\n                                        <button\n                                                type="button"\n                                                class="sui-button-icon sui-tooltip forminator-remove-recipient"\n                                                data-tooltip="{{ Forminator.l10n.popup.remove_user }}"\n                                                data-id="{{ recipient.id }}"\n                                                data-email="{{ recipient.email }}"\n                                                data-type="email">\n                                            <span class="sui-icon-trash" aria-hidden="true"></span>\n                                        </button>\n                                    </div>\n                                    {[ } ]}\n                                    {[ } ]}\n                                </div>\n                            </div>\n\n                            <div class="sui-notice sui-notice-warning sui-margin-top notifications-recipients-notice sui-hidden">\n                                <div class="sui-notice-content">\n                                    <div class="sui-notice-message">\n                                        <span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\n                                        <p></p>\n                                    </div>\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    <\/script>\n    <script type="text/template" id="forminator-edit-reports-content">\n        <div class="sui-box">\n            <div class="sui-box-header">\n                <h3 id="notification-modal-title" class="sui-box-title">{{ Forminator.l10n.popup.configure }}</h3>\n\n                <div class="sui-actions-right">\n                    <button class="sui-button-icon forminator-popup-close">\n                        <span class="sui-icon-close" aria-hidden="true"></span>\n                        <span class="sui-screen-reader-text">Close this modal</span>\n                    </button>\n                </div>\n\n            </div>\n\n            <div class="sui-box-body">\n                <div class="sui-tabs sui-tabs-flushed">\n                    <div role="tablist" class="sui-tabs-menu">\n                        <button type="button" role="tab" id="report-tab-settings"\n                                class="sui-tab-item active" aria-controls="report-tab-settings-content"\n                                aria-selected="true">\n                            {{ Forminator.l10n.popup.settings_label }}\n                        </button>\n\n                        <button type="button" role="tab" id="report-tab-schedule"\n                                class="sui-tab-item" aria-controls="report-tab-schedule-content"\n                                aria-selected="false" tabindex="-1">\n                            {{ Forminator.l10n.popup.schedule_label }}\n                        </button>\n\n                        <button type="button" role="tab" id="report-tab-recipients"\n                                class="sui-tab-item" aria-controls="report-tab-recipients-content"\n                                aria-selected="false" tabindex="-1">\n                            {{ Forminator.l10n.popup.recipients_label }}\n                        </button>\n                    </div>\n\n                    <div class="sui-tabs-content">\n                        <div role="tabpanel" tabindex="0" id="report-tab-settings-content"\n                             class="sui-tab-content reports-settings-content active" aria-labelledby="report-tab-settings">\n                        </div>\n                        <div role="tabpanel" tabindex="0" id="report-tab-schedule-content"\n                             class="sui-tab-content reports-schedule-content" aria-labelledby="report-tab-schedule">\n                        </div>\n                        <div role="tabpanel" tabindex="0" id="report-tab-recipients-content"\n                             class="sui-tab-content reports-recipients-content" aria-labelledby="report-tab-recipients">\n                        </div>\n                    </div>\n                </div>\n            </div>\n\n            <div class="sui-box-footer sui-content-separated">\n                <button class="sui-button sui-button-ghost forminator-cancel-report">\n                    <span class="sui-loading-text">{{ Forminator.l10n.popup.cancel }}</span>\n                    <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                </button>\n                <div class="report-button-with-toggle">\n                    <label for="notification-tab-status" class="sui-toggle">\n                        <input type="checkbox" id="notification-tab-status" class="notification-save-status"\n                               aria-labelledby="notification-tab-status-label"\n                               {{ \'active\' === notification.report_status ? \'checked="checked"\' : \'\' }}>\n                        <span class="sui-toggle-slider" aria-hidden="true"></span>\n                        <span id="notification-tab-status-label" class="sui-toggle-label">\n                            {{ Forminator.l10n.popup.status_label }}\n                        </span>\n                    </label>\n                    <button type="button" class="sui-button sui-button-blue forminator-report-save" aria-live="polite"\n                            data-id="{{ notification.report_id }}">\n                        <span class="sui-button-text-default">\n                            <span class="sui-icon-save" aria-hidden="true"></span>\n                            {{ Forminator.l10n.popup.save_changes }}\n                        </span>\n                        <span class="sui-button-text-onload">\n                            <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>\n                            {{ Forminator.l10n.popup.saving_changes }}\n                        </span>\n                    </button>\n                </div>\n            </div>\n        </div>\n    <\/script>\n</div>'
    17 }),function(t){formintorjs.define("admin/popup/reports-notification",["text!tpl/reports.html"],function(n){return Backbone.View.extend({className:"forminator-popup-create--report-notification",events:{"click label.sui-tab-item":"inputTabs","click .forminator-popup-close":"close","click .forminator-cancel-report":"close","click button.forminator-popup-slide":"slide_modal","click button.forminator-add-recipient":"add_recipient","click button.forminator-remove-recipient":"remove_recipient","click button#add-recipient-button":"invite_add_recipient","click button.forminator-report-save":"report_save"},initialize:function(t){this.report_id=t.report_id},reportAddPopup:Forminator.Utils.template(t(n).find("#forminator-add-reports-content").html()),reportEditPopup:Forminator.Utils.template(t(n).find("#forminator-edit-reports-content").html()),settingsPopup:Forminator.Utils.template(t(n).find("#forminator-reports-settings-content").html()),schedulePopup:Forminator.Utils.template(t(n).find("#forminator-reports-schedule-content").html()),recipientsPopup:Forminator.Utils.template(t(n).find("#forminator-reports-recipients-content").html()),notification:{report_id:0,exclude:[],settings:{label:forminatorl10n.popup.form_reports,module:"forms",forms_type:"all"},schedule:{frequency:"daily"},report_status:"active",recipients:[]},render:function(){if(0!==this.report_id){var t="";"sui-box-body"!==this.className&&(t+='<div class="sui-box-body">'),t+='<p class="fui-loading-dialog" aria-label="Loading content"><i class="sui-icon-loader sui-loading" aria-hidden="true"></i></p>',"sui-box-body"!==this.className&&(t+="</div>"),this.$el.html(t),this.fetch_report_data(this.report_id)}else this.load_users(),this.$el.html(this.reportAddPopup({notification:this.notification})),this.render_html()},render_html:function(){var t=this;this.render_content(),setTimeout(function(){t.initSUI(),t.mapActions()},500)},render_content:function(){this.$el.find(".reports-settings-content").html(this.settingsPopup({settings:this.notification.settings})),this.$el.find(".reports-schedule-content").html(this.schedulePopup({schedule:this.notification.schedule})),this.$el.find(".reports-recipients-content").html(this.recipientsPopup({recipients:this.notification.recipients}))},initSUI:function(){t(".sui-select").each(function(){const n=t(this);"search"===n.data("theme")?SUI.select.initSearch(n):SUI.select.init(n)}),SUI.tabs()},mapActions:function(){this.initUserSelects(),this.toggleAddButton()},slide_modal:function(n){n.preventDefault();const e=t(n.currentTarget).data("modal-slide"),i=t(n.currentTarget).data("modal-slide-focus"),o=t(n.currentTarget).data("modal-slide-intro");SUI.slideModal(e,i,o)},close:function(t){t.preventDefault(),Forminator.Popup.close()},toggleAddButton:function(){const n=t('#notifications-invite-users-content input[id^="recipient-"]');n.on("keyup",function(){var e=!1;n.each(function(){""===t(this).val()&&(e=!0)}),e?t("#add-recipient-button").attr("disabled","disabled"):t("#add-recipient-button").attr("disabled",!1)})},inputTabs:function(t){var n=this.$(t.target),e=n.find("input"),i=e.data("tab-menu"),o=n.closest(".sui-side-tabs"),a=n.closest(".sui-tabs-menu").find(".sui-tab-item");n.is("label")&&(a.removeClass("active"),o.find('.sui-tabs-content div[data-tab-content="'+i+'"]').length&&(o.find('.sui-tabs-content div[data-tab-content="'+i+'"]').attr("hidden",!0),o.find('.sui-tabs-content div[data-tab-content="'+i+'"]').removeClass("active")),n.addClass("active"),o.find("#"+e.attr("aria-controls")).addClass("active"),o.find("#"+e.attr("aria-controls")).attr("hidden",!1),o.find("#"+e.attr("aria-controls")).removeAttr("hidden")),t.preventDefault()},load_users:function(){var n=this;t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_search_users",nonce:forminatorl10n.popup.fetch_nonce,exclude:this.notification.exclude},success:function(e){if(void 0!==e.data){var i=0;e.data.forEach(function(t){n.addToUsersList(t,0==i++)}),n.fixRecipientCSS(t("#forminator-user-list"))}}})},addToUsersList:function(n,e){const i=t("#forminator-user-list"),o=e?"sui-tooltip-bottom-right":"sui-tooltip-top-right";var a='<div class="sui-recipient sui-recipient-rounded" data-id="'+n.id+'" data-email="'+n.email+'"><span class="sui-recipient-name"><span class="subscriber"><img alt="" src="'+n.avatar+'" alt="'+n.email+'"></span><span class="forminator-recipient-name">'+n.name+'</span></span><span class="sui-recipient-email">'+n.role+'</span><button type="button" class="sui-button-icon forminator-add-recipient sui-tooltip '+o+'" data-tooltip="'+forminatorl10n.popup.add_user+'"';a+="data-user='"+JSON.stringify(n)+"'>",a+='<span class="sui-icon-plus" aria-hidden="true"></span></button></div>',i.append(a),this.toggleRecipientList(i,!0)},toggleRecipientList:function(t,n){if(void 0!==t.html()){const e=0===t.html().trim().length;t.parent("div").toggleClass("sui-hidden",e).toggleClass("sui-margin-top",!e),n&&this.toggleUserNotice(!1)}},toggleUserNotice:function(n){const e=t(".notifications-recipients-notice"),i=t("#forminator-popup .sui-button.sui-button-blue"),o=t(".forminator-report-save");var a=forminatorl10n.popup.no_recipients;n?a=forminatorl10n.popup.recipient_exists:0!==this.notification.report_id&&(a=forminatorl10n.popup.no_recipient_disable),e.find("p").html(a),n?(e.removeClass("sui-hidden"),setTimeout(function(){e.addClass("sui-hidden")},3e3)):0===this.notification.recipients.length?(i.attr("disabled","disabled"),o.attr("disabled","disabled"),e.removeClass("sui-hidden")):(i.attr("disabled",!1),o.attr("disabled",!1),e.addClass("sui-hidden"))},fixRecipientCSS:function(t){const n=t.children().length>1?"hidden":"unset";t.css("overflow-x",n),t.find(".sui-recipient:first-of-type .sui-tooltip").removeClass("sui-tooltip-top-right").addClass("sui-tooltip-bottom-right")},add_recipient:function(n,e){if(n.preventDefault(),""!==e&&void 0!==e||(e=t(n.currentTarget).data("user")),"object"===jQuery.type(e)){this.addUser(e,"user");const i=t("#forminator-user-list"),o='.sui-recipient[data-email="'+e.email+'"]';i.find(o).remove(),this.fixRecipientCSS(i),this.toggleRecipientList(i,!1)}},addUser:function(n,e){if(this.notification.recipients.findIndex(function(t){return n.email===t.email})>-1)return void this.toggleUserNotice(!0);const i=t("#modal-"+e+"-recipients-list"),o=""===n.role?n.email:n.role;var a="";void 0!==n.is_pending&&(a=n.is_pending||void 0===n.is_subscribed||n.is_subscribed?n.is_pending?"pending":"confirmed":"unsubscribed");var r='<img src="'+n.avatar+'" alt="'+n.email+'">',s="";"pending"!==a&&"unsubscribed"!==a||(r='<span class="sui-tooltip" data-tooltip="'+forminatorl10n.popup.awaiting_confirmation+'">'+r+"</span>",s='<button type="button" class="resend-invite sui-button-icon sui-tooltip" data-tooltip="'+forminatorl10n.popup.resend_invite+'"><span class="sui-icon-send" aria-hidden="true"></span></button>');const l='<div class="sui-recipient sui-recipient-rounded" data-id="'+n.id+'" data-email="'+n.email+'"><span class="sui-recipient-name"><span class="subscriber '+a+'">'+r+'</span><span class="forminator-recipient-name">'+n.name+'</span></span><span class="sui-recipient-email">'+o+"</span>"+s+'<button type="button" class="sui-button-icon forminator-remove-recipient sui-tooltip" data-tooltip="'+forminatorl10n.popup.remove_user+'" data-id="'+n.id+'" data-email="'+n.email+'"data-type="'+e+'"><span class="sui-icon-trash" aria-hidden="true"></span></button></div>';i.append(l),this.notification.recipients.push(n),"user"===e&&this.notification.exclude.push(n.id),this.toggleRecipientList(i,!0)},remove_recipient:function(n){n.preventDefault();const e=t(n.currentTarget).data("id"),i=t(n.currentTarget).data("email"),o=t(n.currentTarget).data("type"),a=t("#modal-"+o+"-recipients-list"),r='.sui-recipient[data-email="'+i+'"]',s=a.find(r);s.remove();var l;"user"===o&&(l=this.notification.exclude.indexOf(e.toString()),l>-1&&this.notification.exclude.splice(l,1),this.returnToList(s)),l=this.notification.recipients.findIndex(function(t){return e===parseInt(t.id)&&i===t.email}),l>-1&&this.notification.recipients.splice(l,1),this.toggleRecipientList(a,!0)},returnToList:function(n){const e=t("#forminator-user-list"),i={id:n.data("id"),name:n.find(".forminator-recipient-name").text(),email:n.data("email"),role:n.find(".sui-recipient-email").text(),avatar:n.find("img").attr("src")};n.find(".resend-invite").remove(),n.find(".sui-icon-trash").removeClass("sui-icon-trash").addClass("sui-icon-plus"),n.find("button").removeClass("forminator-remove-recipient").attr("data-user",JSON.stringify(i)).attr("data-tooltip",forminatorl10n.popup.add_recipient).addClass("forminator-add-recipient sui-tooltip-top-right"),e.append(n),this.fixRecipientCSS(e),this.toggleRecipientList(e,!1)},initUserSelects:function(){const n=t("#forminator-search-users"),e=this;n.SUIselect2({minimumInputLength:3,maximumSelectionLength:1,ajax:{url:ajaxurl,type:"POST",dataType:"json",delay:250,data:function(t){return{action:"forminator_search_users",nonce:forminatorl10n.popup.fetch_nonce,query:t.term,exclude:e.notification.exclude}},processResults:function(t){return{results:jQuery.map(t.data,function(t,n){return{text:t.name,id:n,user:{name:t.name,email:t.email,role:t.role,avatar:t.avatar,id:t.id}}})}}}}),n.on("select2:select",function(t){e.add_recipient(t,t.params.data.user),n.val(null).trigger("change")})},invite_add_recipient:function(){const n=event.target;var e=this;n.classList.add("sui-button-onload-text");const i=t("input#recipient-name"),o=t("input#recipient-email"),a=t("#error-recipient-email");t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_get_avatar",nonce:forminatorl10n.popup.fetch_nonce,email:o.val()},success:function(t){if(void 0!==t.data){if(a.parents().removeClass("sui-form-field-error"),a.html(""),!t.success)return a.html(t.data.message),a.parents().addClass("sui-form-field-error"),void n.classList.remove("sui-button-onload-text");const r={name:Forminator.Utils.sanitize_text_field(i.val()),email:o.val(),role:"",avatar:t.data,id:0};e.addUser(r,"email"),i.val("").trigger("keyup"),o.val("").trigger("keyup"),n.classList.remove("sui-button-onload-text")}}})},process_settings:function(){this.notification.settings={label:t("input#report-title").val(),module:t('label.active input[name="module"]').val(),forms_type:t('label.active input[name="forms_type"]').val(),selected_forms:t('select[name="select_forms"]').val(),quizzes_type:t('label.active input[name="quizzes_type"]').val(),selected_quizzes:t('select[name="select_quizzes"]').val(),polls_type:t('label.active input[name="polls_type"]').val(),selected_polls:t('select[name="select_polls"]').val()}},process_schedule:function(){this.notification.schedule={frequency:t('label.active input[name="frequency"]').val(),time:t('select[name="report-time"]').val(),weekDay:t('select[name="week-days"]').val(),weekTime:t('select[name="week-time"]').val(),monthDay:t('select[name="month-days"]').val(),monthTime:t('select[name="month-time"]').val(),yearMonth:t('select[name="year-month"]').val(),yearDays:t('select[name="year-days"]').val(),yearTime:t('select[name="year-time"]').val()}},report_save:function(n){n.preventDefault();const e=t(n.currentTarget).data("id");this.process_settings(),this.process_schedule(),0!==this.notification.recipients.length&&this.save(this.notification,e)},save:function(n,e){var i=t("input.notification-save-status").is(":checked");t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_save_report",nonce:forminatorl10n.popup.save_nonce,report_id:e,reports:n,status:i?"active":"inactive"},success:function(t){t.success&&location.reload()}})},fetch_report_data:function(n){const e=this;t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_fetch_report",nonce:forminatorl10n.popup.fetch_nonce,report_id:n},success:function(t){t.success&&void 0!==t.data&&(e.notification=t.data,e.load_users(),e.$el.html(e.reportEditPopup({notification:e.notification})),e.render_html())}}).always(function(){e.$el.find(".fui-loading-dialog").remove()})}})})}(jQuery),function(t){formintorjs.define("admin/popups",["admin/popup/templates","admin/popup/login","admin/popup/quizzes","admin/popup/schedule","admin/popup/new-form","admin/popup/polls","admin/popup/ajax","admin/popup/delete","admin/popup/preview","admin/popup/reset-plugin-settings","admin/popup/disconnect-stripe","admin/popup/disconnect-paypal","admin/popup/approve-user","admin/popup/delete-unconfirmed-user","admin/popup/create-appearance-preset","admin/popup/apply-appearance-preset","admin/popup/confirm","admin/popup/addons-actions","admin/popup/reports-notification"],function(n,e,i,o,a,r,s,l,p,d,c,u,m,f,h,v,b,g,x){var y=Backbone.View.extend({el:"main.sui-wrap",events:{"click .wpmudev-open-modal":"open_modal","click .wpmudev-button-open-modal":"open_modal"},initialize:function(){var t=Forminator.Utils.get_url_param("new"),n=Forminator.Utils.get_url_param("title");if(t){var e=new a({title:n});e.render(),this.open_popup(e,Forminator.l10n.popup.congratulations)}return this.open_export(),this.open_delete(),this.maybeShowNotice(),this.render()},render:function(){return this},maybeShowNotice:function(){var n=Forminator.l10n.notices;n&&t.each(n,function(t,n){var e=4e3;"custom_notice"===t&&(e=void 0),Forminator.Notification.open("success",n,e)})},open_delete:function(){var t=Forminator.Utils.get_url_param("delete"),n=Forminator.Utils.get_url_param("module_id"),e=Forminator.Utils.get_url_param("nonce"),i=Forminator.Utils.get_url_param("module_type"),o=Forminator.l10n.popup.delete_form,a=Forminator.l10n.popup.are_you_sure_form,r=this;"poll"===i&&(o=Forminator.l10n.popup.delete_poll,a=Forminator.l10n.popup.are_you_sure_poll),"quiz"===i&&(o=Forminator.l10n.popup.delete_quiz,a=Forminator.l10n.popup.are_you_sure_quiz),t&&setTimeout(function(){r.open_delete_popup("",n,e,o,a)},100)},open_export:function(){var t=Forminator.Utils.get_url_param("export"),n=Forminator.Utils.get_url_param("module_id"),e=Forminator.Utils.get_url_param("exportnonce"),i=Forminator.Utils.get_url_param("module_type"),o=this;t&&setTimeout(function(){o.open_export_module_modal(i,e,n,Forminator.l10n.popup.export_form,!1,!0,"wpmudev-ajax-popup")},100)},open_modal:function(n){n.preventDefault();var e=t(n.target);t(n.target).closest(".wpmudev-split--item");e.hasClass("wpmudev-open-modal")||e.hasClass("wpmudev-button-open-modal")||(e=e.closest(".wpmudev-open-modal,.wpmudev-button-open-modal"));var i=e.data("modal"),o=e.data("nonce"),a=e.data("form-id"),r=e.data("action"),s=e.data("has-leads"),l=e.data("leads-id"),p=e.data("modal-title"),d=e.data("modal-content"),c=e.data("button-text"),u=e.data("nonce-preview");switch(i){case"custom_forms":this.open_cform_popup();break;case"login_registration_forms":this.open_login_popup();break;case"polls":this.open_polls_popup();break;case"quizzes":this.open_quizzes_popup();break;case"exports":this.open_settings_modal(i,o,a,Forminator.l10n.popup.your_exports);break;case"exports-schedule":this.open_exports_schedule_popup();break;case"delete-module":this.open_delete_popup("",a,o,p,d,r,c);break;case"delete-poll-submission":this.open_delete_popup("poll",a,o,p,d);break;case"paypal":this.open_settings_modal(i,o,a,Forminator.l10n.popup.paypal_settings);break;case"preview_cforms":_.isUndefined(p)&&(p=Forminator.l10n.popup.preview_cforms),this.open_preview_popup(a,p,"forminator_load_form","forminator_forms",u);break;case"preview_polls":_.isUndefined(p)&&(p=Forminator.l10n.popup.preview_polls),this.open_preview_popup(a,p,"forminator_load_poll","forminator_polls",u);break;case"preview_quizzes":_.isUndefined(p)&&(p=Forminator.l10n.popup.preview_quizzes),this.open_quiz_preview_popup(a,p,"forminator_load_quiz","forminator_quizzes",s,l,u);break;case"captcha":this.open_settings_modal(i,o,a,Forminator.l10n.popup.captcha_settings,!1,!0,"wpmudev-ajax-popup");break;case"currency":this.open_settings_modal(i,o,a,Forminator.l10n.popup.currency_settings,!1,!0,"wpmudev-ajax-popup");break;case"pagination_entries":this.open_settings_modal(i,o,a,Forminator.l10n.popup.pagination_entries,!1,!0,"wpmudev-ajax-popup");break;case"pagination_listings":this.open_settings_modal(i,o,a,Forminator.l10n.popup.pagination_listings,!1,!0,"wpmudev-ajax-popup");break;case"email_settings":this.open_settings_modal(i,o,a,Forminator.l10n.popup.email_settings,!1,!0,"wpmudev-ajax-popup");break;case"uninstall_settings":this.open_settings_modal(i,o,a,Forminator.l10n.popup.uninstall_settings,!1,!0,"wpmudev-ajax-popup");break;case"privacy_settings":this.open_settings_modal(i,o,a,Forminator.l10n.popup.privacy_settings,!1,!0,"wpmudev-ajax-popup");break;case"create_preset":this.create_appearance_preset_modal(o,p,d,e);break;case"apply_preset":this.apply_appearance_preset_modal(e);break;case"delete_preset":this.delete_preset_modal(p,d);break;case"export_form":this.open_export_module_modal("form",o,a,Forminator.l10n.popup.export_form,!1,!0,"wpmudev-ajax-popup");break;case"export_poll":this.open_export_module_modal("poll",o,a,Forminator.l10n.popup.export_poll,!1,!0,"wpmudev-ajax-popup");break;case"export_quiz":this.open_export_module_modal("quiz",o,a,Forminator.l10n.popup.export_quiz,!1,!0,"wpmudev-ajax-popup");break;case"import_form":this.open_import_module_modal("form",o,a,Forminator.l10n.popup.import_form,!1,!0,"wpmudev-ajax-popup");break;case"import_form_cf7":this.open_import_module_modal("form_cf7",o,a,Forminator.l10n.popup.import_form_cf7,!1,!0,"wpmudev-ajax-popup");break;case"import_form_ninja":this.open_import_module_modal("form_ninja",o,a,Forminator.l10n.popup.import_form_ninja,!1,!0,"wpmudev-ajax-popup");break;case"import_form_gravity":this.open_import_module_modal("form_gravity",o,a,Forminator.l10n.popup.import_form_gravity,!1,!0,"wpmudev-ajax-popup");break;case"import_poll":this.open_import_module_modal("poll",o,a,Forminator.l10n.popup.import_poll,!1,!0,"wpmudev-ajax-popup");break;case"import_quiz":this.open_import_module_modal("quiz",o,a,Forminator.l10n.popup.import_quiz,!1,!0,"wpmudev-ajax-popup");break;case"reset-plugin-settings":this.open_reset_plugin_settings_popup(o,p,d);break;case"disconnect-stripe":this.open_disconnect_stripe_popup(o,p,d);break;case"disconnect-paypal":this.open_disconnect_paypal_popup(o,p,d);break;case"approve-user-module":var m=e.data("activation-key");this.open_approve_user_popup(o,p,d,m);break;case"delete-unconfirmed-user-module":this.open_unconfirmed_user_popup(e.data("form-id"),o,p,d,e.data("activation-key"),e.data("entry-id"));break;case"addons_page_details":this.open_addons_page_modal(i,o,a,p,!1,!0,"wpmudev-ajax-popup");break;case"addons_page_install":this.open_addons_page_install(i,o,a,p,!1,!0,"wpmudev-ajax-popup");break;case"addons-deactivate":this.open_addons_actions_popup(i,e.data("addon"),o,p,d,e.data("addon-slug"),e.data("is_network"));break;case"configure-report":this.open_reports_notifications_popup(e.data("id"));break;case"delete-report":this.open_delete_popup("",a,o,p,d,r,c)}},open_popup:function(n,e,i,o,a,r,s,l,p){_.isUndefined(e)&&(e=Forminator.l10n.custom_form.popup_label);var d={title:e};_.isUndefined(i)||(d.has_custom_box=i),_.isUndefined(o)||(d.action_text=o),_.isUndefined(a)||(d.action_css_class=a),_.isUndefined(r)||(d.action_callback=r),Forminator.Popup.open(function(){_.isUndefined(n.el)?t(this).append(n):t(this).append(n.el),"function"==typeof s&&s.apply(this)},d,l,p)},open_ajax_popup:function(n,e,i,o,a,r,l,p,d){_.isUndefined(o)&&(o=Forminator.l10n.custom_form.popup_label),_.isUndefined(a)&&(a=!0),_.isUndefined(r)&&(r=!1),_.isUndefined(l)&&(l="sui-box-body");var c=new s({action:n,nonce:e,id:i,enable_loader:!0,className:l}),u={title:o,has_custom_box:r};Forminator.Popup.open(function(){t(this).append(c.el)},u,p,d)},open_delete_popup:function(n,e,i,o,a,r,s){r=r||"delete";var p=new l({module:n,id:e,action:r,nonce:i,referrer:window.location.pathname+window.location.search,button:Forminator.Utils.sanitize_text_field(s),content:Forminator.Utils.sanitize_text_field(a)});p.render();var d=p,c={title:o,has_custom_box:!0};Forminator.Popup.open(function(){_.isUndefined(d.el)?t(this).append(d):t(this).append(d.el)},c,"sm","center")},open_cform_popup:function(){var e=new n({type:"form"});e.render();var i=e,o={title:"",has_custom_box:!0};Forminator.Popup.open(function(){_.isUndefined(i.el)?t(this).append(i):t(this).append(i.el)},o,"lg")},open_polls_popup:function(){var n=new r;n.render();var e=n,i={title:"",has_custom_box:!0};Forminator.Popup.open(function(){_.isUndefined(e.el)?t(this).append(e):t(this).append(e.el)},i,"sm")},open_quizzes_popup:function(){var n=new i;n.render();var e=n,o={title:Forminator.l10n.quiz.choose_quiz_title,has_custom_box:!0};Forminator.Popup.open(function(){_.isUndefined(e.el)?t(this).append(e):t(this).append(e.el)},o,"lg")},open_import_module_modal:function(t,n,e,i,o,a,r){var s="";switch(t){case"form":case"form_cf7":case"form_ninja":case"form_gravity":case"poll":case"quiz":s="import_"+t}this.open_ajax_popup(s,n,e,i,o,a,r,"sm","center")},open_exports_schedule_popup:function(){var t=new o;t.render(),this.open_popup(t,Forminator.l10n.popup.edit_scheduled_export,!0,void 0,void 0,void 0,void 0,"md","inline")},open_reset_plugin_settings_popup:function(n,e,i){var o=new d({nonce:n,referrer:window.location.pathname+window.location.search,content:i});o.render();var a=o,r={title:e,has_custom_box:!0};Forminator.Popup.open(function(){_.isUndefined(a.el)?t(this).append(a):t(this).append(a.el)},r,"sm","center")},open_addons_actions_popup:function(n,e,i,o,a,r,s){s=s||!1;var l=new g({module:n,id:e,nonce:i,is_network:s,referrer:window.location.pathname+window.location.search,content:a,forms:"stripe"===r?forminatorData.stripeForms:[]});l.render();var p=l,d={title:o,has_custom_box:!0};Forminator.Popup.open(function(){_.isUndefined(p.el)?t(this).append(p):t(this).append(p.el)},d,"sm","center")},open_login_popup:function(){var t=new e;t.render(),this.open_popup(t,Forminator.l10n.popup.edit_login_form,void 0,void 0,void 0,void 0,void 0,"md","inline")},open_settings_modal:function(t,n,e,i,o,a,r){this.open_ajax_popup(t,n,e,i,o,a,r,"md","inline")},open_addons_page_modal:function(t,n,e,i,o,a,r){this.open_ajax_popup(t,n,e,i,o,a,r,"md","inline")},open_addons_page_install:function(t,n,e,i,o,a,r){this.open_ajax_popup(t,n,e,i,o,a,r,"lg","inline")},open_export_module_modal:function(t,n,e,i,o,a,r){var s="";switch(t){case"form":case"poll":case"quiz":s="export_"+t}this.open_ajax_popup(s,n,e,i,o,a,r,"md","inline")},open_preview_popup:function(n,e,i,o,a){_.isUndefined(e)&&(e=Forminator.l10n.custom_form.popup_label);var r=new p({action:i,type:o,nonce:a,id:n,enable_loader:!0,className:"sui-box-body"}),s={title:e,has_custom_box:!0};Forminator.Popup.open(function(){t(this).append(r.el)},s,"lg","inline")},open_quiz_preview_popup:function(n,e,i,o,a,r,s){_.isUndefined(e)&&(e=Forminator.l10n.custom_form.popup_label);var l=new p({action:i,type:o,id:n,enable_loader:!0,className:"sui-box-body",has_lead:a,leads_id:r,nonce:s}),d={title:e,has_custom_box:!0};Forminator.Popup.open(function(){t(this).append(l.el)},d,"lg","inline")},apply_appearance_preset_modal:function(n){var e=new v({$target:n});e.render();var i=e;Forminator.Popup.open(function(){t(this).append(i.el)},{title:Forminator.Data.modules.ApplyPreset.title,has_custom_box:!0},"sm","center")},delete_preset_modal:function(n,e){var i=new b({confirmation_message:e,confirm_callback:function(){var t=new Event("deletePreset");window.dispatchEvent(t)}});i.render();var o=i;Forminator.Popup.open(function(){t(this).append(o.el)},{title:n,has_custom_box:!0},"sm","center")},create_appearance_preset_modal:function(n,e,i,o){var a=new h({nonce:n,$target:o,title:e,content:i});a.render();var r=a;Forminator.Popup.open(function(){t(this).append(r.el)},{title:e,has_custom_box:!0},"sm","center")},open_disconnect_stripe_popup:function(n,e,i){var o=new c({nonce:n,referrer:window.location.pathname+window.location.search,content:i});o.render();var a=o,r={title:e,has_custom_box:!0};Forminator.Popup.open(function(){_.isUndefined(a.el)?t(this).append(a):t(this).append(a.el)},r,"sm","center")},open_disconnect_paypal_popup:function(n,e,i){var o=new u({nonce:n,referrer:window.location.pathname+window.location.search,content:i});o.render();var a=o,r={title:e,has_custom_box:!0};Forminator.Popup.open(function(){_.isUndefined(a.el)?t(this).append(a):t(this).append(a.el)},r,"sm","center")},open_approve_user_popup:function(n,e,i,o){var a=new m({nonce:n,referrer:window.location.pathname+window.location.search,content:i,activationKey:o});a.render();var r=a;Forminator.Popup.open(function(){_.isUndefined(r.el)?t(this).append(r):t(this).append(r.el)},{title:e,has_custom_box:!0},"md","inline")},open_unconfirmed_user_popup:function(n,e,i,o,a,r){var s=new f({formId:n,nonce:e,referrer:window.location.pathname+window.location.search,content:o,activationKey:a,entryId:r});s.render();var l=s;Forminator.Popup.open(function(){_.isUndefined(l.el)?t(this).append(l):t(this).append(l.el)},{title:i,has_custom_box:!0},"md","inline")},open_reports_notifications_popup:function(n){var e=new x({type:"reports",report_id:n});e.render();var i=e,o={title:"",has_custom_box:!0};0!==n?Forminator.Popup.open(function(){_.isUndefined(i.el)?t(this).append(i):t(this).append(i.el)},o,"md"):Forminator.Slide_Popup.open(function(){_.isUndefined(i.el)?t(this).append(i):t(this).append(i.el)},o,"md")}});jQuery(function(){new y})})}(jQuery),formintorjs.define("text!tpl/popups.html",[],function(){return'<div>\r\n\r\n\t\x3c!-- Base Structure --\x3e\r\n\t<script type="text/template" id="popup-tpl">\r\n\r\n\t\t<div class="sui-modal">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-popup__title"\r\n\t\t\t\taria-describedby="forminator-popup__description"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- Modal Header: Center-aligned title with floating close button --\x3e\r\n\t<script type="text/template" id="popup-header-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ title }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t\x3c!-- Modal Header: Inline title and close button --\x3e\r\n\t<script type="text/template" id="popup-header-inline-tpl">\r\n\r\n\t\t<div class="sui-box-header">\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title">{{ title }}</h3>\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button-icon forminator-popup-close" data-modal-close>\r\n\t\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-integration-tpl">\r\n\r\n\t\t<div class="sui-modal sui-modal-sm">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-integration-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-integration-popup__title"\r\n\t\t\t\taria-describedby="forminator-integration-popup__description"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-integration-content-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<figure class="sui-box-logo" aria-hidden="true">\r\n\r\n\t\t\t\t<img\r\n\t\t\t\t\tsrc="{{ image }}"\r\n\t\t\t\t\tsrcset="{{ image }} 1x, {{ image_x2 }} 2x"\r\n\t\t\t\t\talt="{{ title }}"\r\n\t\t\t\t/>\r\n\r\n\t\t\t</figure>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--left forminator-addon-back" style="display: none;">\r\n\t\t\t\t<span class="sui-icon-chevron-left sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Back</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-integration-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<div class="forminator-integration-popup__header"></div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="forminator-integration-popup__body sui-box-body"></div>\r\n\r\n\t\t<div class="forminator-integration-popup__footer sui-box-footer sui-flatten sui-content-separated"></div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-loader-tpl">\r\n\r\n\t\t<p style="margin: 0; text-align: center;" aria-hidden="true"><span class="sui-icon-loader sui-md sui-loading"></span></p>\r\n\t\t<p class="sui-screen-reader-text">Loading content...</p>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-stripe-tpl">\r\n\r\n\t\t<div class="sui-modal sui-modal-md">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-stripe-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-stripe-popup__title"\r\n\t\t\t\taria-describedby=""\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-stripe-content-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<figure class="sui-box-logo" aria-hidden="true">\r\n\t\t\t\t<img src="{{ image }}" srcset="{{ image }} 1x, {{ image_x2 }} 2x" alt="{{ title }}" />\r\n\t\t\t</figure>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close">\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-stripe-popup__title" class="sui-box-title sui-lg" style="overflow: initial; display: none; white-space: normal; text-overflow: initial;">{{ title }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10"></div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center"></div>\r\n\r\n\t<\/script>\r\n\r\n\t<script type="text/template" id="popup-slide-tpl">\r\n\t\t<div class="sui-modal sui-modal-lg">\r\n\t\t\t<div\r\n\t\t\t\t\trole="dialog"\r\n\t\t\t\t\tid="forminator-popup"\r\n\t\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\t\taria-modal="true"\r\n\t\t\t\t\taria-labelledby="forminator-slide-popup__title"\r\n\t\t\t\t\taria-describedby="forminator-slide-popup__description"\r\n\t\t\t>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t<\/script>\r\n\r\n</div>\r\n'}),function(t){formintorjs.define("admin/addons/view",["text!tpl/popups.html"],function(n){return Backbone.View.extend({className:"wpmudev-section--integrations",loaderTpl:Forminator.Utils.template(t(n).find("#popup-loader-tpl").html()),model:{},events:{"click .forminator-addon-connect":"connect_addon","click .forminator-addon-disconnect":"disconnect_addon","click .forminator-addon-form-disconnect":"form_disconnect_addon","click .forminator-addon-next":"submit_next_step","click .forminator-addon-back":"go_prev_step","click .forminator-addon-finish":"finish_steps"},initialize:function(t){this.slug=t.slug,this.nonce=t.nonce,this.action=t.action,this.form_id=t.form_id,this.multi_id=t.multi_id,this.global_id=t.global_id,this.step=0,this.next_step=!1,this.prev_step=!1,this.scrollbar_width=this.get_scrollbar_width();var n=this
    18 ;return this.$el.find(".forminator-integration-close, .forminator-addon-close").on("click",function(){n.close(n)}),this.render()},render:function(){var t={};t.action=this.action,t._ajax_nonce=this.nonce,t.data={},t.data.slug=this.slug,t.data.step=this.step,t.data.current_step=this.step,t.data.global_id=this.global_id,this.form_id&&(t.data.form_id=this.form_id),this.multi_id&&(t.data.multi_id=this.multi_id),this.request(t,!1,!0)},request:function(n,e,i){var o=this,a={data:n,close:e,loader:i};i&&(this.$el.find(".forminator-integration-popup__header").html(""),this.$el.find(".forminator-integration-popup__body").html(this.loaderTpl()),this.$el.find(".forminator-integration-popup__footer").html("")),this.$el.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload"),this.ajax=t.post({url:Forminator.Data.ajaxUrl,type:"post",data:n}).done(function(n){if(n&&n.success){o.render_reset(),o.render_body(n),o.render_footer(n),o.hide_elements();var i=n.data.data;o.on_render(i),o.$el.find(".sui-button").removeClass("sui-button-onload"),(e||!_.isUndefined(i.is_close)&&i.is_close)&&o.close(o),o.$el.find(".forminator-addon-close").on("click",function(){o.close(o)}),_.isUndefined(i.notification)||_.isUndefined(i.notification.type)||_.isUndefined(i.notification.text)||Forminator.Notification.open(i.notification.type,i.notification.text,4e3),_.isUndefined(i.has_back)?o.$el.find(".forminator-addon-back").hide():i.has_back?o.$el.find(".forminator-addon-back").show():o.$el.find(".forminator-addon-back").hide(),i.is_poll&&setTimeout(o.request(a.data,a.close,a.loader),5e3);t("#forminator-integration-popup .sui-box").height()>t(window).height()?t("#forminator-integration-popup .sui-dialog-overlay").css("right",o.scrollbar_width+"px"):t("#forminator-integration-popup .sui-dialog-overlay").css("right",0)}}),this.ajax.always(function(){o.$el.find(".fui-loading-dialog").remove()})},render_reset:function(){var n=t(".forminator-integration-popup__body"),e=t(".forminator-integration-popup__footer");n.is(":hidden")&&n.css("display",""),e.is(":hidden")&&e.css("display","")},render_body:function(t){this.$el.find(".forminator-integration-popup__body").html(t.data.data.html);var n=this.$el.find(".forminator-integration-popup__body .forminator-integration-popup__header").remove();n.length>0&&this.$el.find(".forminator-integration-popup__header").html(n.html())},render_footer:function(t){var n=this,e=t.data.data.buttons;n.$el.find(".sui-box-footer").html("");var i=this.$el.find(".forminator-integration-popup__body .forminator-integration-popup__footer-temp").remove();i.length>0&&this.$el.find(".forminator-integration-popup__footer").html(i.html()),_.each(e,function(t){n.$el.find(".sui-box-footer").append(t.markup)}),n.$el.find(".sui-box-footer").removeClass("sui-content-center").addClass("sui-content-separated"),(n.$el.find(".sui-box-footer").children(".forminator-integration-popup__close").length>0||e&&1===Object.keys(e).length)&&n.$el.find(".sui-box-footer").removeClass("sui-content-separated").addClass("sui-content-center")},hide_elements:function(){var n=t(".forminator-integration-popup__body"),e=t(".forminator-integration-popup__footer"),i=n.html(),o=e.html();i.trim().length||n.hide(),o.trim().length||e.hide()},on_render:function(t){this.delegateEvents(),Forminator.Utils.sui_delegate_events(),Forminator.Utils.forminator_select2_tags(this.$el,{}),_.isUndefined(t.forminator_addon_current_step)||(this.step=+t.forminator_addon_current_step),_.isUndefined(t.forminator_addon_has_next_step)||(this.next_step=t.forminator_addon_has_next_step),_.isUndefined(t.forminator_addon_has_prev_step)||(this.prev_step=t.forminator_addon_has_prev_step)},get_step:function(){return this.next_step?this.step+1:this.step},get_prev_step:function(){return this.prev_step?this.step-1:this.step},connect_addon:function(n){var e={},i=this.$el.find("form"),o={slug:this.slug,step:this.get_step(),global_id:this.global_id,current_step:this.step},a=i.serialize();this.form_id&&(o.form_id=this.form_id),this.multi_id&&(o.multi_id=this.multi_id),a=a+"&"+t.param(o),e.action=this.action,e._ajax_nonce=this.nonce,e.data=a,this.request(e,!1,!1)},submit_next_step:function(n){var e={},i=this.$el.find("form"),o={slug:this.slug,step:this.get_step(),global_id:this.global_id,current_step:this.step},a=i.serialize();this.form_id&&(o.form_id=this.form_id),a=a+"&"+t.param(o),e.action=this.action,e._ajax_nonce=this.nonce,e.data=a,this.request(e,!1,!1)},go_prev_step:function(t){var n={},e={slug:this.slug,step:this.get_prev_step(),global_id:this.global_id,current_step:this.step};this.form_id&&(e.form_id=this.form_id),this.multi_id&&(e.multi_id=this.multi_id),n.action=this.action,n._ajax_nonce=this.nonce,n.data=e,this.request(n,!1,!1)},finish_steps:function(n){var e={},i=this.$el.find("form"),o={slug:this.slug,step:this.get_step(),global_id:this.global_id,current_step:this.step},a=i.serialize();this.form_id&&(o.form_id=this.form_id),this.multi_id&&(o.multi_id=this.multi_id),a=a+"&"+t.param(o),e.action=this.action,e._ajax_nonce=this.nonce,e.data=a,this.request(e,!1,!1)},disconnect_addon:function(t){var n={};n.action="forminator_addon_deactivate",n._ajax_nonce=this.nonce,n.data={},n.data.slug=this.slug,n.data.global_id=this.global_id,this.request(n,!0,!1)},form_disconnect_addon:function(t){var n={};n.action="forminator_addon_deactivate_for_module",n._ajax_nonce=this.nonce,n.data={},n.data.slug=this.slug,n.data.form_id=this.form_id,n.data.form_type="form",this.multi_id&&(n.data.multi_id=this.multi_id),this.request(n,!0,!1)},close:function(t){t.ajax.abort(),t.remove(),Forminator.Integrations_Popup.close(),Forminator.Events.trigger("forminator:addons:reload")},get_scrollbar_width:function(){var n=0;if(navigator.userAgent.match("MSIE")){var e=t('<textarea cols="10" rows="2"></textarea>').css({position:"absolute",top:-1e3,left:-1e3}).appendTo("body"),i=t('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>').css({position:"absolute",top:-1e3,left:-1e3}).appendTo("body");n=e.width()-i.width(),e.add(i).remove()}else{var o=t("<div />").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1e3,left:-1e3}).prependTo("body").append("<div />").find("div").css({width:"100%",height:200});n=100-o.width(),o.parent().remove()}return n}})})}(jQuery),function(t){formintorjs.define("admin/addons/addons",["admin/addons/view"],function(n){var e=Backbone.View.extend({el:".sui-wrap.wpmudev-forminator-forminator-integrations",currentTab:"forminator-integrations",events:{"change .forminator-addon-toggle-enabled":"toggle_state","click .connect-integration":"connect_integration","click .forminator-integrations-wrapper .sui-vertical-tab a":"go_to_tab","change .forminator-integrations-wrapper .sui-sidenav-hide-lg select":"go_to_tab","change .forminator-integrations-wrapper .sui-sidenav-hide-lg.integration-nav":"go_to_tab","keyup input.sui-form-control":"required_settings"},initialize:function(n){if(t(this.el).length>0)return this.listenTo(Forminator.Events,"forminator:addons:reload",this.render_addons_page),this.render()},render:function(){this.render_addons_page(),this.update_tab()},render_addons_page:function(){var n=this,e={};this.$el.find("#forminator-integrations-display").html('<div role="alert" id="forminator-addons-preloader" class="sui-notice sui-active" style="display: block;" aria-live="assertive"><div class="sui-notice-content"><div class="sui-notice-message"><span class="sui-notice-icon sui-icon-loader sui-loading" aria-hidden="true"></span><p>Fetching integration list…</p></div></div></div>'),e.action="forminator_addon_get_addons",e._ajax_nonce=Forminator.Data.addonNonce,e.data={},t.post({url:Forminator.Data.ajaxUrl,type:"post",data:e}).done(function(t){t&&t.success&&n.$el.find("#forminator-integrations-page").html(t.data.data)}).always(function(){n.$el.find("#forminator-addons-preloader").remove()})},connect_integration:function(e){e.preventDefault();var i=t(e.target);i.hasClass("connect-integration")||(i=i.closest(".connect-integration"));var o=i.data("nonce"),a=i.data("slug"),r=i.data("multi-global-id"),s=i.data("title"),l=i.data("image"),p=i.data("imagex2"),d=i.data("action"),c=i.data("form-id"),u=i.data("multi-id");Forminator.Integrations_Popup.open(function(){new n({slug:a,nonce:o,action:d,form_id:c,multi_id:u,global_id:r,el:t(this)})},{title:s,image:l,image_x2:p})},go_to_tab:function(n){n.preventDefault();var e=t(n.target),i=e.attr("href"),o="";if(_.isUndefined(i)){o=e.val()}else o=i.replace("#","",i);_.isEmpty(o)||(this.currentTab=o),this.update_tab(),n.stopPropagation()},update_tab_select:function(){this.$el.hasClass("wpmudev-forminator-forminator-integrations")&&(this.$el.find(".sui-sidenav-hide-lg select").val(this.currentTab),this.$el.find(".sui-sidenav-hide-lg select").trigger("sui:change"))},update_tab:function(){this.$el.hasClass("wpmudev-forminator-forminator-integrations")&&(this.clear_tabs(),this.$el.find("[data-tab-id="+this.currentTab+"]").addClass("current"),this.$el.find(".wpmudev-settings--box#"+this.currentTab).show())},clear_tabs:function(){this.$el.hasClass("wpmudev-forminator-forminator-integrations")&&(this.$el.find(".sui-vertical-tab ").removeClass("current"),this.$el.find(".wpmudev-settings--box").hide())},required_settings:function(n){var e=t(n.target),i=e.parent(),o=i.find(".sui-error-message"),a=e.closest("div[data-nav]"),r=a.find(".sui-box-footer"),s=r.find(".wpmudev-action-done");this.$el.hasClass("wpmudev-forminator-forminator-settings")&&(e.hasClass("forminator-required")&&!e.val()&&i.hasClass("sui-form-field")&&(i.addClass("sui-form-field-error"),o.show()),e.hasClass("forminator-required")&&e.val()&&i.hasClass("sui-form-field")&&(i.removeClass("sui-form-field-error"),o.hide()),a.find("input.sui-form-control").hasClass("forminator-required")&&(0===a.find("div.sui-form-field-error").length?s.prop("disabled",!1):s.prop("disabled",!0))),n.stopPropagation()}});jQuery(function(){new e})})}(jQuery),function(t){formintorjs.define("admin/addons-page",[],function(){var n=Backbone.View.extend({el:".wpmudev-forminator-forminator-addons",events:{"click button.addons-actions":"addons_actions","click a.addons-actions":"addons_actions","click .sui-dialog-close":"close","click .addons-modal-close":"close","click .addons-page-details":"open_addons_detail"},initialize:function(){t(".wpmudev-forminator-forminator-addons").length},addons_actions:function(n){var e=this,i=t(n.target),o={},a=i.data("nonce"),r=i.data("action"),s=i.data("popup"),l=i.data("is_network"),p=i.data("addon");return"addons-connect"===r?(e.$el.find(".ssm-session__button").trigger("click"),!1):(o.action="forminator_"+r,o.pid=p,o.is_network=l,o._ajax_nonce=a,i.addClass("sui-button-onload"),e.$el.find(".sui-button.addons-actions:not(.disable-loader)").attr("disabled",!0),t.post({url:Forminator.Data.ajaxUrl,type:"post",data:o}).done(function(t){if(void 0!==t.data.error)return e.show_notification(t.data.error.message,"error"),!1;if("addons-install"===r)setTimeout(function(){e.active_popup(p,"show","forminator-activate-popup"),e.$el.find(".sui-tab-content .addons-"+p).not(this).replaceWith(t.data.html),e.loader_remove()},1e3);else{if(e.show_notification(t.data.message,"success"),e.$el.find(".sui-tab-content .addons-"+p).not(this).replaceWith(t.data.html),"addons-update"===r){var n=e.$el.find("#forminator-modal-addons-details-"+p);e.$el.find("#updates-addons-content .addons-"+p).remove();var o=e.$el.find("#updates-addons-content .sui-col-md-6").length;o<1&&e.$el.find("#updates-addons span.sui-tag").removeClass("sui-tag-yellow"),e.$el.find("#updates-addons span.sui-tag").html(o),n.find(".forminator-details-header--tags span.addons-update-tag").remove();var a=i.data("version");n.find(".forminator-details-header--tags span.addons-version").html(a),n.find(".forminator-details-header button.addons-actions").remove(),i.remove()}s&&location.reload()}}).fail(function(){e.show_notification(Forminator.l10n.commons.error_message,"error")}),!1)},close:function(n){n.preventDefault();var e=t(n.target),i=e.data("addon"),o=e.data("element");this.active_popup(i,"hide",o)},loader_remove:function(){this.$el.find(".sui-button.addons-actions:not(.disable-loader)").removeClass("sui-button-onload").attr("disabled",!1)},show_notification:function(t,n){var e=void 0!==t?t:Forminator.l10n.commons.error_message;Forminator.Notification.open(n,e,4e3),this.loader_remove()},active_popup:function(t,n,e){var i=e+"-"+t,o="forminator-addon-"+t+"__card";"show"===n?SUI.openModal(i,o):SUI.closeModal()},open_addons_detail:function(n){var e=this,i=t(n.target),o=i.data("form-id");e.active_popup(o,"show","forminator-modal-addons-details")}}),n=new n;return n})}(jQuery),function(t){formintorjs.define("admin/reports-page",[],function(){var n=Backbone.View.extend({el:".wpmudev-forminator-forminator-reports",events:{"click .sui-side-tabs label.sui-tab-item input":"sidetabs","click .sui-sidenav .sui-vertical-tab a":"sidenav","change .sui-sidenav select.sui-mobile-nav":"sidenav_select","apply.daterangepicker input.forminator-reports-filter-date":"filter_report_date","click #forminator-checked-all-reports":"check_all","change label input.notification-status":"change_report_status","change label input.report-checkbox":"change_report_check"},initialize:function(){var n=this;t(".wpmudev-forminator-forminator-reports").length&&(n.render_daterange(),n.chartJs=n.forminator_reports_chart(window.monthDays,window.submissions,window.canvas_spacing))},render_daterange:function(){var n=moment().startOf("month"),e=moment().endOf("month");t("input.forminator-reports-filter-date").daterangepicker({autoUpdateInput:!1,autoApply:!0,alwaysShowCalendars:!0,ranges:window.forminator_reports_datepicker_ranges,locale:forminatorl10n.daterangepicker,startDate:n,endDate:e,showCustomRangeLabel:!1}).val(n.format("MMMM DD, YYYY")+" - "+e.format("MMMM DD, YYYY"))},filter_report_date:function(n,e){var i=this,o=t(n.target),a=e.startDate,r=e.endDate,s=i.$el.find("#forminator-reports select[name=form_id]").val(),l=i.$el.find("#forminator-reports select[name=form_type]").val(),p=a.format("MMMM DD, YYYY")+" - "+r.format("MMMM DD, YYYY");i.add_report_loader(),o.val(p),i.$el.find(".forminator-chart-date").html(forminatorl10n.popup.showing_report_from+" "+p),t.post({url:Forminator.Data.ajaxUrl,type:"post",data:{action:"forminator_filter_report_data",form_id:s,form_type:l,_ajax_nonce:o.data("nonce"),start_date:a.format("YYYY-MM-DD"),end_date:r.format("YYYY-MM-DD"),range_time:e.chosenLabel}}).done(function(n){if(n.data){var e=n.data,o=e.reports,a=e.chart_data,r=i.$el.find(".fui-table--apps"),s=i.$el.find("#forminator-reports");t.each(o,function(n,e){var o=i.$el.find(".increment-"+n);if(o.html(""),e.selected>0||0!==e.selected){var a="high"===e.difference?"fui-trend-green":"fui-trend-red",l="high"===e.difference?"sui-icon-arrow-up":"sui-icon-arrow-down",p='<i class="'+l+' sui-sm" aria-hidden="true"></i>';o.html(p+e.increment),o.removeClass("fui-trend-green").removeClass("fui-trend-red").addClass(a)}s.find(".selected-"+n).html(e.selected),s.find(".previous-"+n).html(e.previous),void 0!==e.average&&s.find(".average-"+n).html(e.average),void 0!==e.stripe&&s.find(".stripe-report").html(e.stripe),void 0!==e.paypal&&s.find(".paypal-report").html(e.paypal),i.$el.find(".forminator-reports-chart li.chart-"+n+" span").html(e.selected),"integration"===n&&t.each(e,function(t,n){var e=r.find(".increment-"+t);if(e.html(""),n.selected>0){var i="high"===n.difference?"fui-trend-green":"fui-trend-red",o="high"===n.difference?"sui-icon-arrow-up":"sui-icon-arrow-down",a='<i class="'+o+' sui-sm" aria-hidden="true"></i>';e.html(a+n.increment),e.removeClass("fui-trend-green").removeClass("fui-trend-red").addClass(i)}r.find(".selected-"+t).html(n.selected),r.find(".previous-"+t).html(n.previous)})});var l=a.monthDays,p=a.submissions,d=a.canvas_spacing;e.geolocation&&(i.$el.find("#forminator_report_geolocation_widget .forminator-report-widget-content").html(e.geolocation),SUI.suiAccordion(t(".sui-accordion"))),setTimeout(function(){i.remove_report_loader(o.entries.selected),i.add_chart_data(i.chartJs,l,p,d)},1e3)}}).fail(function(){i.remove_report_loader()})},add_report_loader:function(){this.$el.find(".forminator-reports-box .sui-box").addClass("sui-box__onload"),this.$el.find(".forminator-reports-chart ul.sui-accordion-item-data").addClass("sui-onload"),this.$el.find(".forminator-reports-chart .sui-chartjs").removeClass("sui-chartjs-loaded"),this.$el.find(".sui-chartjs-message--empty").show()},remove_report_loader:function(t){this.$el.find(".forminator-reports-box .sui-box").removeClass("sui-box__onload"),this.$el.find(".forminator-reports-chart ul.sui-accordion-item-data").removeClass("sui-onload"),this.$el.find(".forminator-reports-chart .sui-chartjs").addClass("sui-chartjs-loaded"),0<t&&this.$el.find(".sui-chartjs-message--empty").hide()},add_chart_data:function(t,n,e,i){void 0!==t&&(t.data.labels=n,t.data.datasets[0].data=e,t.options.scales.yAxes[0].ticks.max=i,t.update())},forminator_reports_chart:function(t,n,e){var i=document.getElementById("forminator-module-"+window.chart_form_id+"-stats"),o={labels:t,datasets:[{label:window.chart_label,data:n,backgroundColor:["#E1F6FF"],borderColor:["#17A8E3"],borderWidth:2,pointRadius:0,pointHitRadius:20,pointHoverRadius:5,pointHoverBorderColor:"#17A8E3",pointHoverBackgroundColor:"#17A8E3"}]},a={maintainAspectRatio:!1,legend:{display:!1},scales:{xAxes:[{display:!1,gridLines:{color:"rgba(0, 0, 0, 0)"}}],yAxes:[{display:!1,gridLines:{color:"rgba(0, 0, 0, 0)"},ticks:{beginAtZero:!1,min:0,max:e,stepSize:1}}]},elements:{line:{tension:0},point:{radius:0}},tooltips:{custom:function(t){t&&(t.displayColors=!1)},callbacks:{title:function(t,n){return t[0].yLabel+" "+window.chart_label},label:function(t,n){return t.xLabel},labelTextColor:function(t,n){return"#AAAAAA"}}},plugins:{datalabels:{display:!1}}};if(i)var r=new Chart(i,{type:"line",fill:"start",data:o,plugins:[ChartDataLabels],options:a});return r},sidetabs:function(t){var n=this.$(t.target),e=n.parent("label"),i=n.data("tab-menu"),o=n.closest(".sui-side-tabs"),a=o.find(".sui-tabs-menu .sui-tab-item"),r=a.find("input");n.is("input")&&(a.removeClass("active"),r.removeAttr("checked"),o.find(".sui-tabs-content > div").removeClass("active"),e.addClass("active"),n.prop("checked","checked"),o.find('.sui-tabs-content div[data-tab-content="'+i+'"]').length&&o.find('.sui-tabs-content div[data-tab-content="'+i+'"]').addClass("active"))},sidenav:function(n){var e=t(n.target).data("nav");e&&this.sidenav_go_to(e,!0),n.preventDefault()},sidenav_select:function(n){var e=t(n.target).val();e&&this.sidenav_go_to(e,!0),n.preventDefault()},sidenav_go_to:function(t,n){var e=this.$el.find('a[data-nav="'+t+'"]'),i=e.closest(".sui-vertical-tabs"),o=i.find(".sui-vertical-tab"),a=this.$el.find(".sui-box-reports[data-nav]"),r=this.$el.find('.sui-box-reports[data-nav="'+t+'"]');if(n){var s="admin.php?page=forminator-reports&section="+t;if("dashboard"===t){var l=this.$el.find("#forminator-reports select[name=form_id]").val(),p=this.$el.find("#forminator-reports select[name=form_type]").val();""!==l&&""!==p&&(s="admin.php?page=forminator-reports&form_type="+p+"&form_id="+l)}history.pushState({selected_tab:t},"Reports",s)}o.removeClass("current"),a.hide(),e.parent().addClass("current"),r.show()},check_all:function(n){var e=this.$(n.target),i=e.is(":checked");if(e.closest("table").find(".sui-checkbox input").each(function(){this.checked=i}),t('form[name="report-bulk-action"] input[name="ids"]').length){var o=t("#forminator-reports-list").find('.sui-checkbox input[id|="report"]:checked').map(function(){if(parseFloat(this.value))return this.value}).get().join(",");t('form[name="report-bulk-action"] input[name="ids"]').val(o)}},change_report_status:function(n){var e=n.target.checked?"active":"inactive",i=t(n.target).val();t.ajax({url:Forminator.Data.ajaxUrl,type:"POST",data:{action:"forminator_report_update_status",nonce:forminatorl10n.popup.save_nonce,report_id:i,status:e},success:function(e){var i=n.target.checked?forminatorl10n.popup.deactivate_report:forminatorl10n.popup.activate_report;t(".report-status-tooltip").attr("data-tooltip",i)}})},change_report_check:function(){if(t('form[name="report-bulk-action"] input[name="ids"]').length){var n=t(".sui-checkbox input.report-checkbox:checked").map(function(){if(parseFloat(this.value))return this.value}).get().join(",");t('form[name="report-bulk-action"] input[name="ids"]').val(n)}"forminator-checked-all-reports"!==t(this).attr("id")&&t("#forminator-checked-all-reports").prop("checked",!1)}}),n=new n;return n})}(jQuery),function(t){formintorjs.define("admin/views",["admin/dashboard","admin/settings-page","admin/popups","admin/addons/addons","admin/addons-page","admin/reports-page"],function(t,n,e,i,o,a){return{Views:{Dashboard:t,SettingsPage:n,Popups:e,AddonsPage:o,ReportsPage:a}}})}(jQuery),function(t){formintorjs.define("admin/application",["admin/views"],function(t){return _.extend(Forminator,t),new(Backbone.Router.extend({app:!1,data:!1,layout:!1,module_id:null,routes:{"":"run","*path":"run"},events:{},init:function(){if(!this.data)return this.app=Forminator.Data.application||!1,this.data={},!1},run:function(t){this.init(),this.module_id=t}}))})}(jQuery),formintorjs.define("jquery",[],function(){return jQuery}),formintorjs.define("forminator_global_data",function(){return forminatorData}),formintorjs.define("forminator_language",function(){return forminatorl10n});var Forminator=window.Forminator||{};Forminator.Events={},Forminator.Data={},Forminator.l10n={},Forminator.openPreset=function(t,n){var e=/([?&]preset)=([^&]*)/g,i=window.location.href.replace(e,"$1="+t);i===window.location.href&&(i+="&preset="+t),n&&(i+="&forminator_notice="+n),window.location.href=i},formintorjs.require.config({baseUrl:".",paths:{js:".",admin:"admin"},shim:{backbone:{deps:["underscore","jquery","forminator_global_data","forminator_language"],exports:"Backbone"},underscore:{exports:"_"}},waitSeconds:60}),formintorjs.require(["admin/utils"],function(t){_.templateSettings={evaluate:/\{\[([\s\S]+?)\]\}/g,interpolate:/\{\{([\s\S]+?)\}\}/g},_.extend(Forminator.Data,forminatorData),_.extend(Forminator.l10n,forminatorl10n),_.extend(Forminator,t),_.extend(Forminator.Events,Backbone.Events),formintorjs.require(["admin/application"],function(t){jQuery(function(){_.extend(Forminator,t),Forminator.Events.trigger("application:booted"),Backbone.history.start()})})}),formintorjs.define("admin/setup",function(){}),formintorjs.define("main",function(){});
     2161/*jslint regexp: true */
     2162/*global require: false, XMLHttpRequest: false, ActiveXObject: false,
     2163  define: false, window: false, process: false, Packages: false,
     2164  java: false, location: false */
     2165
     2166formintorjs.define('text',['module'], function (module) {
     2167    'use strict';
     2168
     2169    var text, fs,
     2170        progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
     2171        xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
     2172        bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
     2173        hasLocation = typeof location !== 'undefined' && location.href,
     2174        defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''),
     2175        defaultHostName = hasLocation && location.hostname,
     2176        defaultPort = hasLocation && (location.port || undefined),
     2177        buildMap = [],
     2178        masterConfig = (module.config && module.config()) || {};
     2179
     2180    text = {
     2181        version: '2.0.3',
     2182
     2183        strip: function (content) {
     2184            //Strips <?xml ...?> declarations so that external SVG and XML
     2185            //documents can be added to a document without worry. Also, if the string
     2186            //is an HTML document, only the part inside the body tag is returned.
     2187            if (content) {
     2188                content = content.replace(xmlRegExp, "");
     2189                var matches = content.match(bodyRegExp);
     2190                if (matches) {
     2191                    content = matches[1];
     2192                }
     2193            } else {
     2194                content = "";
     2195            }
     2196            return content;
     2197        },
     2198
     2199        jsEscape: function (content) {
     2200            return content.replace(/(['\\])/g, '\\$1')
     2201                .replace(/[\f]/g, "\\f")
     2202                .replace(/[\b]/g, "\\b")
     2203                .replace(/[\n]/g, "\\n")
     2204                .replace(/[\t]/g, "\\t")
     2205                .replace(/[\r]/g, "\\r")
     2206                .replace(/[\u2028]/g, "\\u2028")
     2207                .replace(/[\u2029]/g, "\\u2029");
     2208        },
     2209
     2210        createXhr: masterConfig.createXhr || function () {
     2211            //Would love to dump the ActiveX crap in here. Need IE 6 to die first.
     2212            var xhr, i, progId;
     2213            if (typeof XMLHttpRequest !== "undefined") {
     2214                return new XMLHttpRequest();
     2215            } else if (typeof ActiveXObject !== "undefined") {
     2216                for (i = 0; i < 3; i += 1) {
     2217                    progId = progIds[i];
     2218                    try {
     2219                        xhr = new ActiveXObject(progId);
     2220                    } catch (e) {}
     2221
     2222                    if (xhr) {
     2223                        progIds = [progId];  // so faster next time
     2224                        break;
     2225                    }
     2226                }
     2227            }
     2228
     2229            return xhr;
     2230        },
     2231
     2232        /**
     2233         * Parses a resource name into its component parts. Resource names
     2234         * look like: module/name.ext!strip, where the !strip part is
     2235         * optional.
     2236         * @param {String} name the resource name
     2237         * @returns {Object} with properties "moduleName", "ext" and "strip"
     2238         * where strip is a boolean.
     2239         */
     2240        parseName: function (name) {
     2241            var strip = false, index = name.indexOf("."),
     2242                modName = name.substring(0, index),
     2243                ext = name.substring(index + 1, name.length);
     2244
     2245            index = ext.indexOf("!");
     2246            if (index !== -1) {
     2247                //Pull off the strip arg.
     2248                strip = ext.substring(index + 1, ext.length);
     2249                strip = strip === "strip";
     2250                ext = ext.substring(0, index);
     2251            }
     2252
     2253            return {
     2254                moduleName: modName,
     2255                ext: ext,
     2256                strip: strip
     2257            };
     2258        },
     2259
     2260        xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
     2261
     2262        /**
     2263         * Is an URL on another domain. Only works for browser use, returns
     2264         * false in non-browser environments. Only used to know if an
     2265         * optimized .js version of a text resource should be loaded
     2266         * instead.
     2267         * @param {String} url
     2268         * @returns Boolean
     2269         */
     2270        useXhr: function (url, protocol, hostname, port) {
     2271            var uProtocol, uHostName, uPort,
     2272                match = text.xdRegExp.exec(url);
     2273            if (!match) {
     2274                return true;
     2275            }
     2276            uProtocol = match[2];
     2277            uHostName = match[3];
     2278
     2279            uHostName = uHostName.split(':');
     2280            uPort = uHostName[1];
     2281            uHostName = uHostName[0];
     2282
     2283            return (!uProtocol || uProtocol === protocol) &&
     2284                   (!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
     2285                   ((!uPort && !uHostName) || uPort === port);
     2286        },
     2287
     2288        finishLoad: function (name, strip, content, onLoad) {
     2289            content = strip ? text.strip(content) : content;
     2290            if (masterConfig.isBuild) {
     2291                buildMap[name] = content;
     2292            }
     2293            onLoad(content);
     2294        },
     2295
     2296        load: function (name, req, onLoad, config) {
     2297            //Name has format: some.module.filext!strip
     2298            //The strip part is optional.
     2299            //if strip is present, then that means only get the string contents
     2300            //inside a body tag in an HTML string. For XML/SVG content it means
     2301            //removing the <?xml ...?> declarations so the content can be inserted
     2302            //into the current doc without problems.
     2303
     2304            // Do not bother with the work if a build and text will
     2305            // not be inlined.
     2306            if (config.isBuild && !config.inlineText) {
     2307                onLoad();
     2308                return;
     2309            }
     2310
     2311            masterConfig.isBuild = config.isBuild;
     2312
     2313            var parsed = text.parseName(name),
     2314                nonStripName = parsed.moduleName + '.' + parsed.ext,
     2315                url = req.toUrl(nonStripName),
     2316                useXhr = (masterConfig.useXhr) ||
     2317                         text.useXhr;
     2318
     2319            //Load the text. Use XHR if possible and in a browser.
     2320            if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) {
     2321                text.get(url, function (content) {
     2322                    text.finishLoad(name, parsed.strip, content, onLoad);
     2323                }, function (err) {
     2324                    if (onLoad.error) {
     2325                        onLoad.error(err);
     2326                    }
     2327                });
     2328            } else {
     2329                //Need to fetch the resource across domains. Assume
     2330                //the resource has been optimized into a JS module. Fetch
     2331                //by the module name + extension, but do not include the
     2332                //!strip part to avoid file system issues.
     2333                req([nonStripName], function (content) {
     2334                    text.finishLoad(parsed.moduleName + '.' + parsed.ext,
     2335                                    parsed.strip, content, onLoad);
     2336                });
     2337            }
     2338        },
     2339
     2340        write: function (pluginName, moduleName, write, config) {
     2341            if (buildMap.hasOwnProperty(moduleName)) {
     2342                var content = text.jsEscape(buildMap[moduleName]);
     2343                write.asModule(pluginName + "!" + moduleName,
     2344                               "define(function () { return '" +
     2345                                   content +
     2346                               "';});\n");
     2347            }
     2348        },
     2349
     2350        writeFile: function (pluginName, moduleName, req, write, config) {
     2351            var parsed = text.parseName(moduleName),
     2352                nonStripName = parsed.moduleName + '.' + parsed.ext,
     2353                //Use a '.js' file name so that it indicates it is a
     2354                //script that can be loaded across domains.
     2355                fileName = req.toUrl(parsed.moduleName + '.' +
     2356                                     parsed.ext) + '.js';
     2357
     2358            //Leverage own load() method to load plugin value, but only
     2359            //write out values that do not have the strip argument,
     2360            //to avoid any potential issues with ! in file names.
     2361            text.load(nonStripName, req, function (value) {
     2362                //Use own write() method to construct full module value.
     2363                //But need to create shell that translates writeFile's
     2364                //write() to the right interface.
     2365                var textWrite = function (contents) {
     2366                    return write(fileName, contents);
     2367                };
     2368                textWrite.asModule = function (moduleName, contents) {
     2369                    return write.asModule(moduleName, fileName, contents);
     2370                };
     2371
     2372                text.write(pluginName, nonStripName, textWrite, config);
     2373            }, config);
     2374        }
     2375    };
     2376
     2377    if (masterConfig.env === 'node' || (!masterConfig.env &&
     2378            typeof process !== "undefined" &&
     2379            process.versions &&
     2380            !!process.versions.node)) {
     2381        //Using special require.nodeRequire, something added by r.js.
     2382        fs = require.nodeRequire('fs');
     2383
     2384        text.get = function (url, callback) {
     2385            var file = fs.readFileSync(url, 'utf8');
     2386            //Remove BOM (Byte Mark Order) from utf8 files if it is there.
     2387            if (file.indexOf('\uFEFF') === 0) {
     2388                file = file.substring(1);
     2389            }
     2390            callback(file);
     2391        };
     2392    } else if (masterConfig.env === 'xhr' || (!masterConfig.env &&
     2393            text.createXhr())) {
     2394        text.get = function (url, callback, errback) {
     2395            var xhr = text.createXhr();
     2396            xhr.open('GET', url, true);
     2397
     2398            //Allow overrides specified in config
     2399            if (masterConfig.onXhr) {
     2400                masterConfig.onXhr(xhr, url);
     2401            }
     2402
     2403            xhr.onreadystatechange = function (evt) {
     2404                var status, err;
     2405                //Do not explicitly handle errors, those should be
     2406                //visible via console output in the browser.
     2407                if (xhr.readyState === 4) {
     2408                    status = xhr.status;
     2409                    if (status > 399 && status < 600) {
     2410                        //An http 4xx or 5xx error. Signal an error.
     2411                        err = new Error(url + ' HTTP status: ' + status);
     2412                        err.xhr = xhr;
     2413                        errback(err);
     2414                    } else {
     2415                        callback(xhr.responseText);
     2416                    }
     2417                }
     2418            };
     2419            xhr.send(null);
     2420        };
     2421    } else if (masterConfig.env === 'rhino' || (!masterConfig.env &&
     2422            typeof Packages !== 'undefined' && typeof java !== 'undefined')) {
     2423        //Why Java, why is this so awkward?
     2424        text.get = function (url, callback) {
     2425            var stringBuffer, line,
     2426                encoding = "utf-8",
     2427                file = new java.io.File(url),
     2428                lineSeparator = java.lang.System.getProperty("line.separator"),
     2429                input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
     2430                content = '';
     2431            try {
     2432                stringBuffer = new java.lang.StringBuffer();
     2433                line = input.readLine();
     2434
     2435                // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
     2436                // http://www.unicode.org/faq/utf_bom.html
     2437
     2438                // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
     2439                // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
     2440                if (line && line.length() && line.charAt(0) === 0xfeff) {
     2441                    // Eat the BOM, since we've already found the encoding on this file,
     2442                    // and we plan to concatenating this buffer with others; the BOM should
     2443                    // only appear at the top of a file.
     2444                    line = line.substring(1);
     2445                }
     2446
     2447                stringBuffer.append(line);
     2448
     2449                while ((line = input.readLine()) !== null) {
     2450                    stringBuffer.append(lineSeparator);
     2451                    stringBuffer.append(line);
     2452                }
     2453                //Make sure we return a JavaScript string and not a Java string.
     2454                content = String(stringBuffer.toString()); //String
     2455            } finally {
     2456                input.close();
     2457            }
     2458            callback(content);
     2459        };
     2460    }
     2461
     2462    return text;
     2463});
     2464
     2465
     2466formintorjs.define('text!admin/templates/popups.html',[],function () { return '<div>\r\n\r\n\t<!-- Base Structure -->\r\n\t<script type="text/template" id="popup-tpl">\r\n\r\n\t\t<div class="sui-modal">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-popup__title"\r\n\t\t\t\taria-describedby="forminator-popup__description"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- Modal Header: Center-aligned title with floating close button -->\r\n\t<script type="text/template" id="popup-header-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ title }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- Modal Header: Inline title and close button -->\r\n\t<script type="text/template" id="popup-header-inline-tpl">\r\n\r\n\t\t<div class="sui-box-header">\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title">{{ title }}</h3>\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button-icon forminator-popup-close" data-modal-close>\r\n\t\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-integration-tpl">\r\n\r\n\t\t<div class="sui-modal sui-modal-sm">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-integration-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-integration-popup__title"\r\n\t\t\t\taria-describedby="forminator-integration-popup__description"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-integration-content-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<figure class="sui-box-logo" aria-hidden="true">\r\n\r\n\t\t\t\t<img\r\n\t\t\t\t\tsrc="{{ image }}"\r\n\t\t\t\t\tsrcset="{{ image }} 1x, {{ image_x2 }} 2x"\r\n\t\t\t\t\talt="{{ title }}"\r\n\t\t\t\t/>\r\n\r\n\t\t\t</figure>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--left forminator-addon-back" style="display: none;">\r\n\t\t\t\t<span class="sui-icon-chevron-left sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Back</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-integration-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<div class="forminator-integration-popup__header"></div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="forminator-integration-popup__body sui-box-body"></div>\r\n\r\n\t\t<div class="forminator-integration-popup__footer sui-box-footer sui-flatten sui-content-separated"></div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-loader-tpl">\r\n\r\n\t\t<p style="margin: 0; text-align: center;" aria-hidden="true"><span class="sui-icon-loader sui-md sui-loading"></span></p>\r\n\t\t<p class="sui-screen-reader-text">Loading content...</p>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-stripe-tpl">\r\n\r\n\t\t<div class="sui-modal sui-modal-md">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-stripe-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-stripe-popup__title"\r\n\t\t\t\taria-describedby=""\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-stripe-content-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<figure class="sui-box-logo" aria-hidden="true">\r\n\t\t\t\t<img src="{{ image }}" srcset="{{ image }} 1x, {{ image_x2 }} 2x" alt="{{ title }}" />\r\n\t\t\t</figure>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close">\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-stripe-popup__title" class="sui-box-title sui-lg" style="overflow: initial; display: none; white-space: normal; text-overflow: initial;">{{ title }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10"></div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center"></div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-slide-tpl">\r\n\t\t<div class="sui-modal sui-modal-lg">\r\n\t\t\t<div\r\n\t\t\t\t\trole="dialog"\r\n\t\t\t\t\tid="forminator-popup"\r\n\t\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\t\taria-modal="true"\r\n\t\t\t\t\taria-labelledby="forminator-slide-popup__title"\r\n\t\t\t\t\taria-describedby="forminator-slide-popup__description"\r\n\t\t\t>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</script>\r\n\r\n</div>\r\n';});
     2467
     2468(function ($) {
     2469    window.empty = function (what) { return "undefined" === typeof what ? true : !what; };
     2470    window.count = function (what) { return "undefined" === typeof what ? 0 : (what && what.length ? what.length : 0); };
     2471    window.stripslashes = function (what) {
     2472        return (what + '')
     2473        .replace(/\\(.?)/g, function (s, n1) {
     2474            switch (n1) {
     2475                case '\\':
     2476                    return '\\'
     2477                case '0':
     2478                    return '\u0000'
     2479                case '':
     2480                    return ''
     2481                default:
     2482                    return n1
     2483            }
     2484        });
     2485    };
     2486    window.forminator_array_value_exists = function ( array, key ) {
     2487        return ( !_.isUndefined( array[ key ] ) && ! _.isEmpty( array[ key ] ) );
     2488    };
     2489    window.decodeHtmlEntity = function(str) {
     2490        if( typeof str === "undefined" ) return str;
     2491
     2492        return str.replace( /&#(\d+);/g, function( match, dec ) {
     2493            return String.fromCharCode( dec );
     2494        });
     2495    };
     2496    window.encodeHtmlEntity = function(str) {
     2497        if( typeof str === "undefined" ) return str;
     2498        var buf = [];
     2499        for ( var i=str.length-1; i>=0; i-- ) {
     2500            buf.unshift( ['&#', str[i].charCodeAt(), ';'].join('') );
     2501        }
     2502        return buf.join('');
     2503    };
     2504    window.singularPluralText = function( count, singular, plural ) {
     2505        var txt  = '';
     2506
     2507        if ( count < 2 ) {
     2508            txt = singular;
     2509        } else {
     2510            txt = plural;
     2511        }
     2512
     2513        return count + ' ' + txt;
     2514    };
     2515
     2516    window.isTrue = function( value ) {
     2517        if ( 'undefined' === typeof( value ) ) {
     2518            return false;
     2519        }
     2520        if ( 'string' === typeof( value ) ) {
     2521            value = value.trim().toLowerCase();
     2522        }
     2523
     2524        switch( value ){
     2525            case true:
     2526            case "true":
     2527            case 1:
     2528            case "1":
     2529            case "on":
     2530            case "yes":
     2531                return true;
     2532            default:
     2533                return false;
     2534        }
     2535    };
     2536
     2537    formintorjs.define('admin/utils',[
     2538        'text!admin/templates/popups.html'
     2539    ], function ( popupTpl ) {
     2540        var Utils = {
     2541            /**
     2542             * generated field id
     2543             * {
     2544             *  type : [id,id]
     2545             * }
     2546             * sample
     2547             * {text:[1,2,3],phone:[1,2,3]}
     2548             */
     2549            fields_ids: [],
     2550
     2551            /**
     2552             * Forminator_Google_font_families
     2553             * @since 1.0.5
     2554             */
     2555            google_font_families: [],
     2556            /*
     2557             * Returns if touch device ( using wp_is_mobile() )
     2558             */
     2559            is_touch: function () {
     2560                return Forminator.Data.is_touch;
     2561            },
     2562
     2563            /*
     2564             * Returns if window resized for browser
     2565             */
     2566            is_mobile_size: function () {
     2567                if ( window.screen.width <= 782 ) return true;
     2568
     2569                return false;
     2570            },
     2571
     2572            /*
     2573             * Return if touch or windows mobile width
     2574             */
     2575            is_mobile: function () {
     2576                if( Forminator.Utils.is_touch() || Forminator.Utils.is_mobile_size() ) return true;
     2577
     2578                return false;
     2579            },
     2580
     2581            /*
     2582             * Extend default underscore template with mustache style
     2583             */
     2584            template: function( markup ) {
     2585                // Each time we re-render the dynamic markup we initialize mustache style
     2586                _.templateSettings = {
     2587                    evaluate : /\{\[([\s\S]+?)\]\}/g,
     2588                    interpolate : /\{\{([\s\S]+?)\}\}/g
     2589                };
     2590
     2591                return _.template( markup );
     2592            },
     2593
     2594            /*
     2595             * Extend default underscore template with PHP
     2596             */
     2597            template_php: function( markup ) {
     2598                var oldSettings = _.templateSettings,
     2599                tpl = false;
     2600
     2601                _.templateSettings = {
     2602                    interpolate : /<\?php echo (.+?) \?>/g,
     2603                    evaluate: /<\?php (.+?) \?>/g
     2604                };
     2605
     2606                tpl = _.template(markup);
     2607
     2608                _.templateSettings = oldSettings;
     2609
     2610                return function(data){
     2611                    _.each(data, function(value, key){
     2612                        data['$' + key] = value;
     2613                    });
     2614
     2615                    return tpl(data);
     2616                };
     2617            },
     2618
     2619            /**
     2620             * Capitalize string
     2621             *
     2622             * @param value
     2623             * @returns {string}
     2624             */
     2625            ucfirst: function( value ) {
     2626                return value.charAt(0).toUpperCase() + value.slice(1);
     2627            },
     2628
     2629            /*
     2630             * Returns slug from title
     2631             */
     2632            get_slug: function ( title ) {
     2633                title = title.replace( ' ', '-' );
     2634                title = title.replace( /[^-a-zA-Z0-9]/, '' );
     2635                return title;
     2636            },
     2637
     2638            /*
     2639             * Returns slug from title
     2640             */
     2641            sanitize_uri_string: function ( string ) {
     2642                // Decode URI components
     2643                var decoded = decodeURIComponent( string );
     2644
     2645                // Replace interval with -
     2646                decoded = decoded.replace( /-/g, ' ' );
     2647
     2648                return decoded;
     2649            },
     2650
     2651            /**
     2652             * Sanitize the user input string.
     2653             *
     2654             * @param {string} string
     2655             */
     2656            sanitize_text_field: function ( string ) {
     2657                if ( !_.isUndefined( string ) ) {
     2658                    var str = String(string).replace(/[&\/\\#^+()$~%.'":*?<>{}!@]/g, '');
     2659                    return str.trim();
     2660                }
     2661
     2662                return string;
     2663            },
     2664
     2665            /*
     2666             * Return URL param value
     2667             */
     2668            get_url_param: function ( param ) {
     2669                var page_url = window.location.search.substring(1),
     2670                    url_params = page_url.split('&')
     2671                ;
     2672
     2673                for ( var i = 0; i < url_params.length; i++ ) {
     2674                    var param_name = url_params[i].split('=');
     2675                    if ( param_name[0] === param ) {
     2676                        return param_name[1];
     2677                    }
     2678                }
     2679
     2680                return false;
     2681            },
     2682
     2683            /**
     2684             * Check if email acceptable by WP
     2685             * @param value
     2686             * @returns {boolean}
     2687             */
     2688            is_email_wp: function (value) {
     2689                if (value.length < 6) {
     2690                    return false;
     2691                }
     2692
     2693                // Test for an @ character after the first position
     2694                if (value.indexOf('@', 1) < 0) {
     2695                    return false;
     2696                }
     2697
     2698                // Split out the local and domain parts
     2699                var parts = value.split('@', 2);
     2700
     2701                // LOCAL PART
     2702                // Test for invalid characters
     2703                if (!parts[0].match(/^[a-zA-Z0-9!#$%&'*+\/=?^_`{|}~\.-]+$/)) {
     2704                    return false;
     2705                }
     2706
     2707                // DOMAIN PART
     2708                // Test for sequences of periods
     2709                if (parts[1].match(/\.{2,}/)) {
     2710                    return false;
     2711                }
     2712
     2713                var domain = parts[1];
     2714                // Split the domain into subs
     2715                var subs = domain.split('.');
     2716                if (subs.length < 2) {
     2717                    return false;
     2718                }
     2719
     2720                var subsLen = subs.length;
     2721                for (var i = 0; i < subsLen; i++) {
     2722                    // Test for invalid characters
     2723                    if (!subs[i].match(/^[a-z0-9-]+$/i)) {
     2724                        return false;
     2725                    }
     2726                }
     2727                return true;
     2728            },
     2729
     2730            forminator_select2_tags: function( $el, options ) {
     2731                var select = $el.find( 'select.sui-select.fui-multi-select' );
     2732
     2733                // SELECT2 forminator-ui-tags
     2734                select.each( function() {
     2735                    var select       = $( this ),
     2736                        getParent    = select.closest( '.sui-modal-content' ),
     2737                        getParentId  = getParent.attr( 'id' ),
     2738                        selectParent = ( getParent.length ) ? $( '#' + getParentId ) : $( 'SUI_BODY_CLASS' ),
     2739                        hasSearch    = ( 'true' === select.attr( 'data-search' ) ) ? 0 : -1,
     2740                        isSmall      = select.hasClass( 'sui-select-sm' ) ? 'sui-select-dropdown-sm' : '';
     2741
     2742                    options = _.defaults( options, {
     2743                        dropdownParent: selectParent,
     2744                        minimumResultsForSearch: hasSearch,
     2745                        dropdownCssClass: isSmall
     2746                    });
     2747
     2748                    // reorder-support, it will preserve order based on user tags added
     2749                    if ( select.attr( 'data-reorder' ) ) {
     2750                        select.on( 'select2:select', function( e ) {
     2751                            var elm  = e.params.data.element,
     2752                                $elm = $( elm ),
     2753                                $t   = select;
     2754
     2755                            $t.append( $elm );
     2756                            $t.trigger( 'change.select2' );
     2757                        });
     2758                    }
     2759
     2760                    select.SUIselect2( options );
     2761                });
     2762            },
     2763
     2764            forminator_select2_custom: function ($el, options) {
     2765                // SELECT2 custom
     2766                $el.find( 'select.sui-select.custom-select2' ).each( function() {
     2767                    var select       = $( this ),
     2768                        getParent    = select.closest( '.sui-modal-content' ),
     2769                        getParentId  = getParent.attr( 'id' ),
     2770                        selectParent = ( getParent.length ) ? $( '#' + getParentId ) : $( 'body' ),
     2771                        hasSearch    = ( 'true' === select.attr( 'data-search' ) ) ? 0 : -1,
     2772                        isSmall      = select.hasClass( 'sui-select-sm' ) ? 'sui-select-dropdown-sm' : '';
     2773
     2774                    options = _.defaults( options, {
     2775                        dropdownParent: selectParent,
     2776                        minimumResultsForSearch: hasSearch,
     2777                        dropdownCssClass: isSmall
     2778                    });
     2779
     2780                    // Reorder-support, it will preserve order based on user tags added.
     2781                    if ( select.attr( 'data-reorder' ) ) {
     2782                        select.on( 'select2:select', function( e ) {
     2783                            var elm  = e.params.data.element,
     2784                                $elm = $(elm),
     2785                                $t   = $( this );
     2786                            $t.append( $elm );
     2787                            $t.trigger( 'change.select2' );
     2788                        });
     2789                    }
     2790
     2791                    select.SUIselect2( options );
     2792                });
     2793            },
     2794
     2795            /*
     2796             * Initialize Select 2
     2797             */
     2798            init_select2: function(){
     2799                var self = this;
     2800                if ( 'object' !== typeof window.SUI ) return;
     2801            },
     2802
     2803            load_google_fonts: function (callback) {
     2804                var self = this;
     2805                $.ajax({
     2806                    url : Forminator.Data.ajaxUrl,
     2807                    type: "POST",
     2808                    data: {
     2809                        action: "forminator_load_google_fonts",
     2810                        _wpnonce: Forminator.Data.gFontNonce
     2811                    }
     2812                }).done(function (result) {
     2813                    if (result.success === true) {
     2814                        // cache result
     2815                        self.google_font_families = result.data;
     2816                    }
     2817                    // do callback even font_families is empty
     2818                    callback.apply(result, [self.google_font_families]);
     2819                });
     2820            },
     2821
     2822            sui_delegate_events: function() {
     2823                var self = this;
     2824                if ( 'object' !== typeof window.SUI ) return;
     2825
     2826                // Time it out
     2827                setTimeout( function() {
     2828                    // Rebind Accordion scripts.
     2829                    SUI.suiAccordion($('.sui-accordion'));
     2830
     2831                    // Rebind Tabs scripts.
     2832                    SUI.suiTabs( $( '.sui-tabs' ) );
     2833
     2834                    // Rebind Select2 scripts.
     2835                    $( 'select.sui-select[data-theme="icon"]' ).each( function() {
     2836                        SUI.select.initIcon( $( this ) );
     2837                    });
     2838
     2839                    $( 'select.sui-select[data-theme="color"]' ).each( function() {
     2840                        SUI.select.initColor( $( this ) );
     2841                    });
     2842
     2843                    $( 'select.sui-select[data-theme="search"]' ).each( function() {
     2844                        SUI.select.initSearch( $( this ) );
     2845                    });
     2846
     2847                    $( 'select.sui-select:not([data-theme]):not(.custom-select2):not(.fui-multi-select)' ).each( function() {
     2848                        SUI.select.init( $( this ) );
     2849                    });
     2850
     2851                    // Rebind Variables scripts.
     2852                    $( 'select.sui-variables' ).each( function() {
     2853                        SUI.select.initVars( $( this ) );
     2854                    });
     2855
     2856                    // Rebind Circle scripts.
     2857                    SUI.loadCircleScore( $( '.sui-circle-score' ) );
     2858
     2859                    // Rebind Password scripts.
     2860                    SUI.showHidePassword();
     2861
     2862                }, 50);
     2863            },
     2864        };
     2865
     2866        var Popup = {
     2867            $popup: {},
     2868            _deferred: {},
     2869
     2870            initialize: function () {
     2871
     2872                var tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-tpl' ).html() );
     2873
     2874                if ( ! $( "#forminator-popup" ).length ) {
     2875                    $( "main.sui-wrap" ).append( tpl({}) );
     2876                } else {
     2877                    $( "#forminator-popup" ).remove();
     2878                    this.initialize();
     2879                }
     2880
     2881                this.$popup = $( "#forminator-popup" );
     2882                this.$popupId = 'forminator-popup';
     2883                this.$focusAfterClosed = 'wpbody-content';
     2884
     2885            },
     2886
     2887            open: function ( callback, data, size, title ) {
     2888                this.data             = data;
     2889                this.title            = '';
     2890                this.action_text      = '';
     2891                this.action_callback  = false;
     2892                this.action_css_class = '';
     2893                this.has_custom_box   = false;
     2894                this.has_footer       = true;
     2895
     2896                var header_tpl = '';
     2897
     2898                switch ( title ) {
     2899                    case 'inline':
     2900                        header_tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-header-inline-tpl' ).html() );
     2901                        break;
     2902
     2903                    case 'center':
     2904                        header_tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-header-tpl' ).html() );
     2905                        break;
     2906                }
     2907
     2908                if ( !_.isUndefined( this.data ) ) {
     2909                    if ( !_.isUndefined( this.data.title ) ) {
     2910                        this.title = Forminator.Utils.sanitize_text_field( this.data.title );
     2911                    }
     2912
     2913                    if ( !_.isUndefined( this.data.has_footer ) ) {
     2914                        this.has_footer = this.data.has_footer;
     2915                    }
     2916
     2917                    if ( !_.isUndefined( this.data.action_callback ) &&
     2918                        !_.isUndefined( this.data.action_text ) ) {
     2919                        this.action_callback = this.data.action_callback;
     2920                        this.action_text = this.data.action_text;
     2921                        if ( !_.isUndefined( this.data.action_css_class ) ) {
     2922                            this.action_css_class = this.data.action_css_class;
     2923                        }
     2924                    }
     2925
     2926                    if ( !_.isUndefined( this.data.has_custom_box ) ) {
     2927                        this.has_custom_box = this.data.has_custom_box;
     2928                    }
     2929                }
     2930
     2931                this.initialize();
     2932
     2933                // restart base structure
     2934                if ( '' !== header_tpl ) {
     2935                    this.$popup.find( '.sui-box' ).html( header_tpl({
     2936                        title: this.title
     2937                    }) );
     2938                }
     2939
     2940                var self = this,
     2941                    close_click = function () {
     2942                        self.close();
     2943                        return false;
     2944                    }
     2945                ;
     2946
     2947                // Set modal size
     2948                if ( size ) {
     2949                    this.$popup.closest( '.sui-modal' )
     2950                        .addClass( 'sui-modal-' + size );
     2951                }
     2952
     2953                if ( this.has_custom_box ) {
     2954                    callback.apply( this.$popup.find( '.sui-box' ).get(), data );
     2955                } else {
     2956                    var box_markup = '<div class="sui-box-body">' +
     2957                        '</div>';
     2958
     2959                    if( this.has_footer ) {
     2960                        box_markup += '<div class="sui-box-footer">' +
     2961                            '<button class="sui-button forminator-popup-cancel">' + Forminator.l10n.popup.cancel +'</button>' +
     2962                        '</div>';
     2963                    }
     2964
     2965                    this.$popup.find('.sui-box').append( box_markup );
     2966                    callback.apply(this.$popup.find(".sui-box-body").get(), data);
     2967                }
     2968
     2969                // Add additional Button if callback_action available
     2970                if (this.action_text && this.action_callback) {
     2971                    var action_callback = this.action_callback;
     2972                    this.$popup.find('.sui-box-footer').append(
     2973                        '<div class="sui-actions-right">' +
     2974                            '<button class="forminator-popup-action sui-button ' + this.action_css_class + '">' + this.action_text + '</button>' +
     2975                        '</div>'
     2976                    );
     2977                    this.$popup.find('.forminator-popup-action').on('click', function(){
     2978                        if( action_callback ) {
     2979                            action_callback.apply();
     2980                        }
     2981                        self.close();
     2982                    });
     2983                } else {
     2984                    this.$popup.find('.forminator-popup-action').remove();
     2985                }
     2986
     2987                // Add closing event
     2988                this.$popup.find( ".forminator-popup-close" ).on( "click", close_click );
     2989                this.$popup.find( ".forminator-popup-cancel" ).on( "click", close_click );
     2990                this.$popup.on( "click", '.forminator-popup-cancel', close_click );
     2991
     2992                // Open Modal
     2993                SUI.openModal(
     2994                    this.$popupId,
     2995                    this.$focusAfterClosed,
     2996                    undefined,
     2997                    true,
     2998                    true
     2999                );
     3000
     3001                // Delegate SUI events
     3002                Forminator.Utils.sui_delegate_events();
     3003
     3004                this._deferred = new $.Deferred();
     3005                return this._deferred.promise();
     3006            },
     3007
     3008            close: function ( result, callback ) {
     3009                var self = this;
     3010                // Close Modal
     3011                SUI.closeModal();
     3012
     3013                setTimeout(function () {
     3014
     3015                    // Remove modal size.
     3016                    self.$popup.closest( '.sui-modal' )
     3017                        .removeClass( 'sui-modal-sm' )
     3018                        .removeClass( 'sui-modal-md' )
     3019                        .removeClass( 'sui-modal-lg' )
     3020                        .removeClass( 'sui-modal-xl' );
     3021
     3022                    if( callback ) {
     3023                        callback.apply();
     3024                    }
     3025                }, 300);
     3026
     3027                this._deferred.resolve( this.$popup, result );
     3028            }
     3029        };
     3030
     3031        var Notification = {
     3032            $notification: {},
     3033            _deferred: {},
     3034
     3035            initialize: function () {
     3036
     3037                if ( ! $( ".sui-floating-notices" ).length ) {
     3038
     3039                    $( "main.sui-wrap" )
     3040                        .prepend(
     3041                            '<div class="sui-floating-notices">' +
     3042                                '<div role="alert" id="forminator-floating-notification" class="sui-notice" aria-live="assertive"></div>' +
     3043                            '</div>'
     3044                        );
     3045
     3046                } else {
     3047                    $( ".sui-floating-notices" ).remove();
     3048                    this.initialize();
     3049                }
     3050
     3051                this.$notification = $( "#forminator-floating-notification" );
     3052            },
     3053
     3054            open: function ( type, text, closeTime ) {
     3055                var self = this;
     3056                var noticeTimeOut = closeTime;
     3057
     3058                if ( ! _.isUndefined( closeTime ) ) {
     3059                    noticeTimeOut = 5000;
     3060                }
     3061
     3062                this.uniq = 'forminator-floating-notification';
     3063                this.text = '<p>' + text + '</p>';
     3064                this.type = '';
     3065                this.time = closeTime || 5000;
     3066
     3067                if ( ! _.isUndefined( type ) && '' !== type ) {
     3068                    this.type = type;
     3069                }
     3070
     3071                if ( ! _.isUndefined( closeTime ) ) {
     3072                    this.time = closeTime;
     3073                }
     3074
     3075                this.opts = {
     3076                    type: this.type,
     3077                    autoclose: {
     3078                        show: true,
     3079                        timeout: this.time
     3080                    }
     3081                };
     3082
     3083                this.initialize();
     3084
     3085                SUI.openNotice(
     3086                    this.uniq,
     3087                    this.text,
     3088                    this.opts
     3089                );
     3090
     3091
     3092                setTimeout( function () {
     3093                    self.close();
     3094                }, 3000 );
     3095
     3096                this._deferred = new $.Deferred();
     3097                return this._deferred.promise();
     3098            },
     3099
     3100            close: function ( result ) {
     3101                this._deferred.resolve( this.$popup, result );
     3102            }
     3103        };
     3104
     3105        var Integrations_Popup = {
     3106            $popup: {},
     3107            _deferred: {},
     3108
     3109            initialize: function () {
     3110                var tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-integration-tpl' ).html() );
     3111
     3112                if ( ! $( "#forminator-integration-popup" ).length ) {
     3113
     3114                    $( "main.sui-wrap" ).append( tpl({
     3115                        provider_image: '',
     3116                        provider_image2: '',
     3117                        provider_title: ''
     3118                    }));
     3119
     3120                } else {
     3121                    $( "#forminator-integration-popup" ).remove();
     3122                    this.initialize();
     3123                }
     3124
     3125                this.$popup = $( "#forminator-integration-popup" );
     3126                this.$popupId = 'forminator-integration-popup';
     3127                this.$focusAfterClosed = 'forminator-integrations-page';
     3128
     3129            },
     3130
     3131            open: function ( callback, data, className ) {
     3132                this.data             = data;
     3133                this.title            = '';
     3134                this.image            = '';
     3135                this.image_x2         = '';
     3136                this.action_text      = '';
     3137                this.action_callback  = false;
     3138                this.action_css_class = '';
     3139                this.has_custom_box   = false;
     3140                this.has_footer       = true;
     3141
     3142                if ( !_.isUndefined( this.data ) ) {
     3143                    if ( !_.isUndefined( this.data.title ) ) {
     3144                        this.title = this.data.title;
     3145                    }
     3146
     3147                    if ( !_.isUndefined( this.data.image ) ) {
     3148                        this.image = this.data.image;
     3149                    }
     3150
     3151                    if ( !_.isUndefined( this.data.image_x2 ) ) {
     3152                        this.image_x2 = this.data.image_x2;
     3153                    }
     3154                }
     3155
     3156                this.initialize();
     3157
     3158                // restart base structure
     3159                var tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-integration-content-tpl' ).html() );
     3160
     3161                this.$popup.find('.sui-box').html(tpl({
     3162                    image: this.image,
     3163                    image_x2: this.image_x2,
     3164                    title: this.title
     3165                }));
     3166
     3167                var self = this,
     3168                    close_click = function () {
     3169                        self.close();
     3170                        return false;
     3171                    }
     3172                ;
     3173
     3174                // Add custom class
     3175                if ( className ) {
     3176                    this.$popup
     3177                        .addClass( className )
     3178                    ;
     3179                }
     3180
     3181                callback.apply(this.$popup.get(), data);
     3182
     3183                // Add additional Button if callback_action available
     3184                if (this.action_text && this.action_callback) {
     3185                    var action_callback = this.action_callback;
     3186                    this.$popup.find('.sui-box-footer').append(
     3187                        '<button class="forminator-popup-action sui-button ' + this.action_css_class + '">' + this.action_text + '</button>'
     3188                    );
     3189                    this.$popup.find('.forminator-popup-action').on('click', function(){
     3190                        if( action_callback ) {
     3191                            action_callback.apply();
     3192                        }
     3193                        self.close();
     3194                    });
     3195                } else {
     3196                    this.$popup.find('.forminator-popup-action').remove();
     3197                }
     3198
     3199                // Add closing event
     3200                this.$popup.find( ".sui-dialog-close" ).on( "click", close_click );
     3201                this.$popup.on( "click", '.forminator-popup-cancel', close_click );
     3202
     3203                // Open Modal
     3204                SUI.openModal( this.$popupId, this.$focusAfterClosed );
     3205
     3206                // Delegate SUI events
     3207                Forminator.Utils.sui_delegate_events();
     3208
     3209                this._deferred = new $.Deferred();
     3210                return this._deferred.promise();
     3211            },
     3212
     3213            close: function ( result, callback ) {
     3214
     3215                // Refrest add-on list
     3216                Forminator.Events.trigger( "forminator:addons:reload" );
     3217
     3218                // Close Modal
     3219                SUI.closeModal();
     3220
     3221                setTimeout(function () {
     3222                    if( callback ) {
     3223                        callback.apply();
     3224                    }
     3225                }, 300);
     3226
     3227                this._deferred.resolve( this.$popup, result );
     3228            }
     3229        };
     3230
     3231        var Stripe_Popup = {
     3232            $popup: {},
     3233            _deferred: {},
     3234
     3235            initialize: function () {
     3236                var tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-stripe-tpl' ).html() );
     3237
     3238                if ( ! $( "#forminator-stripe-popup" ).length ) {
     3239
     3240                    $( "main.sui-wrap" ).append( tpl({
     3241                        provider_image: '',
     3242                        provider_image2: '',
     3243                        provider_title: ''
     3244                    }));
     3245
     3246                } else {
     3247                    $( "#forminator-stripe-popup" ).remove();
     3248                    this.initialize();
     3249                }
     3250
     3251                this.$popup = $( "#forminator-stripe-popup" );
     3252                this.$popupId = 'forminator-stripe-popup';
     3253                this.$focusAfterClosed = 'wpbody-content';
     3254
     3255            },
     3256
     3257            open: function ( callback, data ) {
     3258                this.data             = data;
     3259                this.title            = '';
     3260                this.image            = '';
     3261                this.image_x2         = '';
     3262                this.action_text      = '';
     3263                this.action_callback  = false;
     3264                this.action_css_class = '';
     3265                this.has_custom_box   = false;
     3266                this.has_footer       = true;
     3267
     3268                if ( !_.isUndefined( this.data ) ) {
     3269                    if ( !_.isUndefined( this.data.title ) ) {
     3270                        this.title = this.data.title;
     3271                    }
     3272
     3273                    if ( !_.isUndefined( this.data.image ) ) {
     3274                        this.image = this.data.image;
     3275                    }
     3276
     3277                    if ( !_.isUndefined( this.data.image_x2 ) ) {
     3278                        this.image_x2 = this.data.image_x2;
     3279                    }
     3280                }
     3281
     3282                this.initialize();
     3283
     3284                // restart base structure
     3285                var tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-stripe-content-tpl' ).html() );
     3286
     3287                this.$popup.find('.sui-box').html(tpl({
     3288                    image: this.image,
     3289                    image_x2: this.image_x2,
     3290                    title: this.title
     3291                }));
     3292
     3293                this.$popup.find('.sui-box-footer').css({
     3294                    'padding-top': '0',
     3295                });
     3296
     3297                var self = this,
     3298                    close_click = function () {
     3299                        self.close();
     3300                        return false;
     3301                    }
     3302                ;
     3303
     3304                callback.apply(this.$popup.get(), data);
     3305
     3306                // Add additional Button if callback_action available
     3307                if (this.action_text && this.action_callback) {
     3308                    var action_callback = this.action_callback;
     3309                    this.$popup.find('.sui-box-footer').append(
     3310                        '<div class="sui-actions-right">' +
     3311                        '<button class="forminator-popup-action sui-button ' + this.action_css_class + '">' + this.action_text + '</button>' +
     3312                        '</div>'
     3313                    );
     3314                    this.$popup.find('.forminator-popup-action').on('click', function(){
     3315                        if( action_callback ) {
     3316                            action_callback.apply();
     3317                        }
     3318                        self.close();
     3319                    });
     3320                } else {
     3321                    this.$popup.find('.forminator-popup-action').remove();
     3322                }
     3323
     3324                // Add closing event
     3325                this.$popup.find( ".forminator-popup-close" ).on( "click", close_click );
     3326                this.$popup.on( "click", '.forminator-popup-cancel', close_click );
     3327
     3328                // Open Modal
     3329                SUI.openModal(
     3330                    this.$popupId,
     3331                    this.$focusAfterClosed,
     3332                    undefined,
     3333                    true,
     3334                    true
     3335                );
     3336
     3337                // Delegate SUI events
     3338                Forminator.Utils.sui_delegate_events();
     3339
     3340                this._deferred = new $.Deferred();
     3341                return this._deferred.promise();
     3342            },
     3343
     3344            close: function ( result, callback ) {
     3345
     3346                // Close Modal
     3347                SUI.closeModal();
     3348
     3349                var self = this;
     3350
     3351                setTimeout(function () {
     3352
     3353                    // Remove modal size.
     3354                    self.$popup.closest( '.sui-modal' )
     3355                        .removeClass( 'sui-modal-sm' )
     3356                        .removeClass( 'sui-modal-md' )
     3357                        .removeClass( 'sui-modal-lg' )
     3358                        .removeClass( 'sui-modal-xl' );
     3359
     3360                    if( callback ) {
     3361                        callback.apply();
     3362                    }
     3363                }, 300);
     3364
     3365                this._deferred.resolve( this.$popup, result );
     3366            }
     3367        };
     3368
     3369        var Slide_Popup = {
     3370            $popup: {},
     3371            _deferred: {},
     3372
     3373            initialize: function () {
     3374
     3375                var tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-slide-tpl' ).html() );
     3376
     3377                if ( ! $( "#forminator-popup" ).length ) {
     3378                    $( "main.sui-wrap" ).append( tpl({}) );
     3379                } else {
     3380                    $( "#forminator-popup" ).remove();
     3381                    this.initialize();
     3382                }
     3383
     3384                this.$popup = $( "#forminator-popup" );
     3385                this.$popupId = 'forminator-popup';
     3386                this.$focusAfterClosed = 'wpbody-content';
     3387
     3388            },
     3389
     3390            open: function ( callback, data, size, title ) {
     3391                this.data             = data;
     3392                this.title            = '';
     3393                this.action_text      = '';
     3394                this.action_callback  = false;
     3395                this.action_css_class = '';
     3396                this.has_custom_box   = false;
     3397                this.has_footer       = true;
     3398
     3399                var header_tpl = '';
     3400
     3401                switch ( title ) {
     3402                    case 'inline':
     3403                        header_tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-header-inline-tpl' ).html() );
     3404                        break;
     3405
     3406                    case 'center':
     3407                        header_tpl = Forminator.Utils.template( $( popupTpl ).find( '#popup-header-tpl' ).html() );
     3408                        break;
     3409                }
     3410
     3411                if ( !_.isUndefined( this.data ) ) {
     3412                    if ( !_.isUndefined( this.data.title ) ) {
     3413                        this.title = this.data.title;
     3414                    }
     3415
     3416                    if ( !_.isUndefined( this.data.has_footer ) ) {
     3417                        this.has_footer = this.data.has_footer;
     3418                    }
     3419
     3420                    if ( !_.isUndefined( this.data.action_callback ) &&
     3421                        !_.isUndefined( this.data.action_text ) ) {
     3422                        this.action_callback = this.data.action_callback;
     3423                        this.action_text = this.data.action_text;
     3424                        if ( !_.isUndefined( this.data.action_css_class ) ) {
     3425                            this.action_css_class = this.data.action_css_class;
     3426                        }
     3427                    }
     3428
     3429                    if ( !_.isUndefined( this.data.has_custom_box ) ) {
     3430                        this.has_custom_box = this.data.has_custom_box;
     3431                    }
     3432                }
     3433
     3434                this.initialize();
     3435
     3436                // restart base structure
     3437                if ( '' !== header_tpl ) {
     3438                    this.$popup.html( header_tpl({
     3439                        title: this.title
     3440                    }) );
     3441                }
     3442
     3443                var self = this,
     3444                    close_click = function () {
     3445                        self.close();
     3446                        return false;
     3447                    }
     3448                ;
     3449
     3450                // Set modal size
     3451                if ( size ) {
     3452                    this.$popup.closest( '.sui-modal' )
     3453                        .addClass( 'sui-modal-' + size );
     3454                }
     3455
     3456                if ( this.has_custom_box ) {
     3457                    callback.apply( this.$popup.get(), data );
     3458                } else {
     3459                    var box_markup = '<div class="sui-box-body">' +
     3460                        '</div>';
     3461
     3462                    if( this.has_footer ) {
     3463                        box_markup += '<div class="sui-box-footer">' +
     3464                            '<button class="sui-button forminator-popup-cancel">' + Forminator.l10n.popup.cancel +'</button>' +
     3465                            '</div>';
     3466                    }
     3467
     3468                    this.$popup.append( box_markup );
     3469                    callback.apply(this.$popup.find(".sui-box-body").get(), data);
     3470                }
     3471
     3472                // Add additional Button if callback_action available
     3473                if (this.action_text && this.action_callback) {
     3474                    var action_callback = this.action_callback;
     3475                    this.$popup.find('.sui-box-footer').append(
     3476                        '<div class="sui-actions-right">' +
     3477                        '<button class="forminator-popup-action sui-button ' + this.action_css_class + '">' + this.action_text + '</button>' +
     3478                        '</div>'
     3479                    );
     3480                    this.$popup.find('.forminator-popup-action').on('click', function(){
     3481                        if( action_callback ) {
     3482                            action_callback.apply();
     3483                        }
     3484                        self.close();
     3485                    });
     3486                } else {
     3487                    this.$popup.find('.forminator-popup-action').remove();
     3488                }
     3489
     3490                // Add closing event
     3491                this.$popup.find( ".forminator-popup-close" ).on( "click", close_click );
     3492                this.$popup.find( ".forminator-popup-cancel" ).on( "click", close_click );
     3493                this.$popup.on( "click", '.forminator-popup-cancel', close_click );
     3494
     3495                // Open Modal
     3496                SUI.openModal(
     3497                    this.$popupId,
     3498                    this.$focusAfterClosed,
     3499                    undefined,
     3500                    true,
     3501                    true
     3502                );
     3503
     3504                // Delegate SUI events
     3505                Forminator.Utils.sui_delegate_events();
     3506
     3507                this._deferred = new $.Deferred();
     3508                return this._deferred.promise();
     3509            },
     3510
     3511            close: function ( result, callback ) {
     3512                var self = this;
     3513                // Close Modal
     3514                SUI.closeModal();
     3515
     3516                setTimeout(function () {
     3517
     3518                    // Remove modal size.
     3519                    self.$popup.closest( '.sui-modal' )
     3520                        .removeClass( 'sui-modal-sm' )
     3521                        .removeClass( 'sui-modal-md' )
     3522                        .removeClass( 'sui-modal-lg' )
     3523                        .removeClass( 'sui-modal-xl' );
     3524
     3525                    if( callback ) {
     3526                        callback.apply();
     3527                    }
     3528                }, 300);
     3529
     3530                this._deferred.resolve( this.$popup, result );
     3531            }
     3532        };
     3533
     3534        return {
     3535            Utils: Utils,
     3536            Popup: Popup,
     3537            Integrations_Popup: Integrations_Popup,
     3538            Stripe_Popup: Stripe_Popup,
     3539            Notification: Notification,
     3540            Slide_Popup: Slide_Popup,
     3541        };
     3542    });
     3543
     3544})(jQuery);
     3545
     3546(function ($) {
     3547    formintorjs.define('admin/dashboard',[
     3548    ], function( TemplatesPopup ) {
     3549        var Dashboard = Backbone.View.extend({
     3550            el: '.wpmudev-dashboard-section',
     3551            events: {
     3552                "click .wpmudev-action-close": "dismiss_welcome"
     3553            },
     3554            initialize: function () {
     3555                var notification = Forminator.Utils.get_url_param( 'notification' ),
     3556                    form_title = Forminator.Utils.get_url_param( 'title' ),
     3557                    create = Forminator.Utils.get_url_param( 'createnew' )
     3558                ;
     3559
     3560                setTimeout( function() {
     3561                    if ( $( '.forminator-scroll-to' ).length ) {
     3562                        $('html, body').animate({
     3563                            scrollTop: $( '.forminator-scroll-to' ).offset().top - 50
     3564                        }, 'slow');
     3565                    }
     3566                }, 100 );
     3567
     3568                if( notification ) {
     3569                    var markup = _.template( '<strong>{{ formName }}</strong> {{ Forminator.l10n.options.been_published }}' );
     3570
     3571                    Forminator.Notification.open( 'success', markup({
     3572                        formName: Forminator.Utils.sanitize_uri_string( form_title )
     3573                    }), 4000 );
     3574                }
     3575
     3576                if ( create ) {
     3577                    setTimeout( function() {
     3578                        jQuery( '.forminator-create-' + create ).click();
     3579                    }, 200 );
     3580                }
     3581
     3582                return this.render();
     3583            },
     3584
     3585            dismiss_welcome: function( e ) {
     3586                e.preventDefault();
     3587
     3588                var $container = $( e.target ).closest( '.sui-box' ),
     3589                    $nonce = $( e.target ).data( "nonce" )
     3590                ;
     3591
     3592                $container.slideToggle( 300, function() {
     3593                    $.ajax({
     3594                        url: Forminator.Data.ajaxUrl,
     3595                        type: "POST",
     3596                        data: {
     3597                            action: "forminator_dismiss_welcome",
     3598                            _ajax_nonce: $nonce
     3599                        },
     3600                        complete: function( result ){
     3601                            $container.remove();
     3602                        }
     3603                    });
     3604                });
     3605            },
     3606
     3607            render: function() {
     3608
     3609                if ( $( '#forminator-new-feature' ).length > 0 ) {
     3610
     3611                    setTimeout( function () {
     3612                        SUI.openModal(
     3613                            'forminator-new-feature',
     3614                            'wpbody-content'
     3615                        );
     3616                    }, 300 );
     3617                }
     3618            }
     3619        });
     3620
     3621        var DashView = new Dashboard();
     3622
     3623        return DashView;
     3624    });
     3625})(jQuery);
     3626
     3627(function ($) {
     3628    formintorjs.define('admin/settings-page',[
     3629    ], function() {
     3630        var SettingsPage = Backbone.View.extend({
     3631            el: '.wpmudev-forminator-forminator-settings, .wpmudev-forminator-forminator-addons',
     3632            events: {
     3633                'click .sui-side-tabs label.sui-tab-item input': 'sidetabs',
     3634                "click .sui-sidenav .sui-vertical-tab a": "sidenav",
     3635                "change .sui-sidenav select.sui-mobile-nav": "sidenav_select",
     3636                "click .stripe-connect-modal" : 'open_stripe_connect_modal', // Button in Global Settings > Payments > Stripe
     3637                "click .paypal-connect-modal" : 'open_paypal_connect_modal',
     3638                "click .forminator-stripe-connect" : 'connect_stripe', // Button inside the modal.
     3639                "click .disconnect_stripe": "disconnect_stripe",
     3640                "click .forminator-connect-addon" : 'connect_addon',
     3641                "click .forminator-paypal-connect" : 'connect_paypal',
     3642                "click .disconnect_paypal": "disconnect_paypal",
     3643                'click button.sui-tab-item': 'buttonTabs',
     3644                "click .forminator-toggle-unsupported-settings": "show_unsupported_settings",
     3645                "click .forminator-dismiss-unsupported": "hide_unsupported_settings",
     3646                "click button.addons-configure": "open_configure_connect_modal", // Configure button in Add-ons page.
     3647                'keyup input.forminator-custom-directory-value': 'show_custom_directory',
     3648            },
     3649            initialize: function () {
     3650                var self = this;
     3651
     3652                // only trigger on settings page
     3653                if (!$('.wpmudev-forminator-forminator-settings').length && !$('.wpmudev-forminator-forminator-addons').length ) {
     3654                    return;
     3655                }
     3656                // on submit
     3657                this.$el.find('.forminator-settings-save').submit( function(e) {
     3658                    e.preventDefault();
     3659
     3660                    var $form = $( this ),
     3661                        nonce = $form.find('.wpmudev-action-done').data( "nonce" ),
     3662                        action = $form.find('.wpmudev-action-done').data( "action" ),
     3663                        title = $form.find('.wpmudev-action-done').data( "title" ),
     3664                        isReload = $form.find('.wpmudev-action-done').data( "isReload" )
     3665                    ;
     3666
     3667                    self.submitForm( $( this ), action, nonce, title, isReload );
     3668                });
     3669
     3670                var hash = window.location.hash;
     3671                if( ! _.isUndefined( hash ) && ! _.isEmpty( hash ) ) {
     3672                    this.sidenav_go_to( hash.substring(1), true );
     3673                }
     3674
     3675                this.renderHcaptcha();
     3676                this.render( 'v2' );
     3677                this.render( 'v2-invisible' );
     3678                this.render( 'v3' );
     3679
     3680                // Save captcha tab last saved
     3681                this.captchaTab();
     3682            },
     3683
     3684            captchaTab: function() {
     3685                var $captchaType = this.$el.find( 'input[name="captcha_tab_saved"]' ),
     3686                    $tabs        = this.$el.find( 'button.captcha-main-tab' )
     3687                ;
     3688
     3689                $tabs.on( 'click', function ( e ) {
     3690                    e.preventDefault();
     3691                    $captchaType.val( $( this ).data( 'tab-name' ) );
     3692                } );
     3693            },
     3694
     3695            render: function ( captcha ) {
     3696                var self = this,
     3697                    $container = this.$el.find( '#' + captcha + '-recaptcha-preview' )
     3698                ;
     3699
     3700                var preloader =
     3701                    '<p class="fui-loading-dialog">' +
     3702                    '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' +
     3703                    '</p>'
     3704                ;
     3705
     3706                $container.html( preloader );
     3707
     3708                $.ajax({
     3709                    url : Forminator.Data.ajaxUrl,
     3710                    type: "POST",
     3711                    data: {
     3712                        action: "forminator_load_recaptcha_preview",
     3713                        _ajax_nonce: forminatorData.loadCaptcha,
     3714                        captcha: captcha,
     3715                    }
     3716                }).done(function (result) {
     3717                    if( result.success ) {
     3718                        $container.html( result.data );
     3719                    }
     3720                });
     3721            },
     3722
     3723            renderHcaptcha: function () {
     3724                var $hcontainer = this.$el.find( '#hcaptcha-preview' );
     3725
     3726                var preloader =
     3727                    '<p class="fui-loading-dialog">' +
     3728                    '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' +
     3729                    '</p>'
     3730                ;
     3731
     3732                $hcontainer.html( preloader );
     3733
     3734                $.ajax({
     3735                    url : Forminator.Data.ajaxUrl,
     3736                    type: "POST",
     3737                    data: {
     3738                        action: "forminator_load_hcaptcha_preview",
     3739                        _ajax_nonce: forminatorData.loadCaptcha,
     3740                    }
     3741                }).done(function (result) {
     3742                    if( result.success ) {
     3743                        $hcontainer.html( result.data );
     3744                    }
     3745                });
     3746            },
     3747
     3748            submitForm: function( $form, action, nonce, title, isReload ) {
     3749                var data = {},
     3750                    self = this
     3751                ;
     3752
     3753                data.action = 'forminator_save_' + action + '_popup';
     3754                data._ajax_nonce = nonce;
     3755
     3756                var ajaxData = $form.serialize() + '&' + $.param(data);
     3757
     3758                $.ajax({
     3759                    url: Forminator.Data.ajaxUrl,
     3760                    type: "POST",
     3761                    data: ajaxData,
     3762                    beforeSend: function() {
     3763                        $form.find('.sui-button').prop( 'disabled', true );
     3764                        $form.find('.wpmudev-action-done').addClass('sui-button-onload');
     3765                    },
     3766                    success: function( result ) {
     3767                        var markup = _.template( '<strong>{{ tab }}</strong> {{ Forminator.l10n.commons.update_successfully }}' ),
     3768                            notifType = 'success',
     3769                            message = markup({ tab: Forminator.Utils.sanitize_text_field( title ) })
     3770                        ;
     3771
     3772                        if ( ! result.success ) {
     3773                            notifType = 'error';
     3774                            message = result.data;
     3775
     3776                        }
     3777
     3778                        if (!_.isUndefined(message)) {
     3779                            Forminator.Notification.open( notifType, message, 4000 );
     3780                        }
     3781
     3782                        if( action === "captcha" ) {
     3783
     3784                            $captcha_tab_saved = $form.find( 'input[name="captcha_tab_saved"]' ).val();
     3785                            $captcha_tab_saved = '' === $captcha_tab_saved ? 'recaptcha' : $captcha_tab_saved;
     3786                            if ( 'recaptcha' === $captcha_tab_saved ) {
     3787                                self.render( 'v2' );
     3788                                self.render( 'v2-invisible' );
     3789                                self.render( 'v3' );
     3790                            } else if ( 'hcaptcha' === $captcha_tab_saved ) {
     3791                                self.renderHcaptcha();
     3792                            }
     3793
     3794                        } else if ( 'geolocation_settings' === action ) {
     3795                            // For Geolocation settings.
     3796                            var showError = ! result.success,
     3797                                keyField = $( '#forminator-settings--place-ip' ).parent();
     3798
     3799                            if ( showError ) {
     3800                                keyField.addClass( 'sui-form-field-error' ).find( '.sui-error-message' ).removeClass( 'sui-hidden' );
     3801                            } else {
     3802                                keyField.removeClass( 'sui-form-field-error' ).find( '.sui-error-message' ).addClass( 'sui-hidden' );
     3803                            }
     3804                        }
     3805
     3806                        if (isReload) {
     3807                            window.location.reload();
     3808                        }
     3809                    },
     3810                    error: function ( error ) {
     3811                        Forminator.Notification.open( 'error', Forminator.l10n.commons.update_unsuccessfull, 4000 );
     3812                    }
     3813                }).always(function(){
     3814                    $form.find('.sui-button').prop( 'disabled', false );
     3815                    $form.find('.wpmudev-action-done').removeClass('sui-button-onload');
     3816                });
     3817            },
     3818
     3819            sidetabs: function( e ) {
     3820                var $this      = this.$( e.target ),
     3821                    $label     = $this.parent( 'label' ),
     3822                    $data      = $this.data( 'tab-menu' ),
     3823                    $wrapper   = $this.closest( '.sui-side-tabs' ),
     3824                    $alllabels = $wrapper.find( '.sui-tabs-menu .sui-tab-item' ),
     3825                    $allinputs = $alllabels.find( 'input' )
     3826                ;
     3827
     3828                if ( $this.is( 'input' ) ) {
     3829
     3830                    $alllabels.removeClass( 'active' );
     3831                    $allinputs.removeAttr( 'checked' );
     3832                    $wrapper.find( '.sui-tabs-content > div' ).removeClass( 'active' );
     3833
     3834                    $label.addClass( 'active' );
     3835                    $this.prop( 'checked', 'checked' );
     3836
     3837                    if ( $wrapper.find( '.sui-tabs-content div[data-tab-content="' + $data + '"]' ).length ) {
     3838                        $wrapper.find( '.sui-tabs-content div[data-tab-content="' + $data + '"]' ).addClass( 'active' );
     3839                    }
     3840                }
     3841            },
     3842
     3843            sidenav: function( e ) {
     3844                var tab_name = $( e.target ).data( 'nav' );
     3845                if ( tab_name ) {
     3846                    this.sidenav_go_to( tab_name, true );
     3847                }
     3848                e.preventDefault();
     3849
     3850            },
     3851
     3852            sidenav_select: function( e ) {
     3853                var tab_name = $(e.target).val();
     3854                if ( tab_name ) {
     3855                    this.sidenav_go_to( tab_name, true );
     3856                }
     3857                e.preventDefault();
     3858
     3859            },
     3860
     3861            sidenav_go_to: function( tab_name, update_history ) {
     3862
     3863                var $tab     = this.$el.find( 'a[data-nav="' + tab_name + '"]' ),
     3864                    $sidenav = $tab.closest( '.sui-vertical-tabs' ),
     3865                    $tabs    = $sidenav.find( '.sui-vertical-tab' ),
     3866                    $content = this.$el.find( '.sui-box[data-nav]' ),
     3867                    $current = this.$el.find( '.sui-box[data-nav="' + tab_name + '"]' );
     3868
     3869                if ( update_history ) {
     3870                    history.pushState( { selected_tab: tab_name }, 'Global Settings', 'admin.php?page=forminator-settings&section=' + tab_name );
     3871                }
     3872
     3873                $tabs.removeClass( 'current' );
     3874                $content.hide();
     3875
     3876                $tab.parent().addClass( 'current' );
     3877                $current.show();
     3878            },
     3879
     3880            open_configure_connect_modal: function ( e ) {
     3881                var $target = $(e.target),
     3882                    slug = $target.data('slug'),
     3883                    actions = $target.data('action');
     3884                if ( 'stripe-connect-modal' === actions ) {
     3885                    this.open_stripe_connect_modal( e );
     3886                } else if ( 'paypal-connect-modal' === actions ) {
     3887                    this.open_paypal_connect_modal( e );
     3888                } else if ( slug ) {
     3889                    this.open_connect_modal( e, slug );
     3890                }
     3891            },
     3892
     3893            open_stripe_connect_modal: function (e) {
     3894
     3895                e.preventDefault();
     3896
     3897                var self = this;
     3898                var $target  = $(e.target);
     3899                var image    = $target.data('modalImage');
     3900                var image_x2 = $target.data('modalImageX2');
     3901                var title    = $target.data('modalTitle');
     3902                var nonce    = $target.data('modalNonce');
     3903
     3904                var popup_options = {
     3905                    title: Forminator.Utils.sanitize_text_field( title ),
     3906                    image: image,
     3907                    image_x2: image_x2
     3908                }
     3909
     3910                Forminator.Stripe_Popup.open( function () {
     3911                    var popup = $(this);
     3912                    self.render_stripe_connect_modal_content(popup, nonce, {});
     3913                }, popup_options );
     3914
     3915                return false;
     3916            },
     3917
     3918            render_stripe_connect_modal_content: function (popup, popup_nonce, request_data) {
     3919                var self = this;
     3920                request_data.action      = 'forminator_stripe_settings_modal';
     3921                request_data._ajax_nonce = popup_nonce;
     3922                request_data.page_slug   = Forminator.Utils.get_url_param( 'page' );
     3923
     3924                var preloader =
     3925                    '<p class="fui-loading-modal">' +
     3926                    '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' +
     3927                    '</p>'
     3928                ;
     3929
     3930                popup.find(".sui-box-body").html(preloader);
     3931
     3932                $.post({
     3933                    url: Forminator.Data.ajaxUrl,
     3934                    type: 'post',
     3935                    data: request_data
     3936                })
     3937                    .done(function (result) {
     3938                        if (result && result.success) {
     3939                            // Imitate title loading
     3940                            popup.find(".sui-box-header h3.sui-box-title").show();
     3941
     3942                            // Render popup body
     3943                            popup.find(".sui-box-body").html(result.data.html);
     3944
     3945                            // Render popup footer
     3946                            var buttons = result.data.buttons;
     3947
     3948                            // Clear footer from previous buttons
     3949                            popup.find(".sui-box-footer").html('');
     3950
     3951                            // Append buttons
     3952                            _.each( buttons, function( button ) {
     3953                                popup.find( '.sui-box-footer' ).append( button.markup );
     3954                            });
     3955
     3956                            popup.find(".sui-button").removeClass("sui-button-onload");
     3957
     3958                            // Handle notifications
     3959                            if (!_.isUndefined(result.data.notification) &&
     3960                                !_.isUndefined(result.data.notification.type) &&
     3961                                !_.isUndefined(result.data.notification.text) &&
     3962                                !_.isUndefined(result.data.notification.duration)
     3963                            ) {
     3964
     3965                                Forminator.Notification.open(result.data.notification.type, result.data.notification.text, result.data.notification.duration)
     3966                                    .done(function () {
     3967                                        // Notification opened
     3968                                    });
     3969
     3970                                self.update_stripe_page( popup_nonce );
     3971                            }
     3972                        }
     3973                    });
     3974            },
     3975
     3976            update_stripe_page: function( nonce ) {
     3977                var new_request = {
     3978                    action: 'forminator_stripe_update_page',
     3979                    _ajax_nonce: nonce,
     3980                }
     3981
     3982                $.post({
     3983                    url: Forminator.Data.ajaxUrl,
     3984                    type: 'get',
     3985                    data: new_request
     3986                })
     3987                    .done(function (result) {
     3988                        // Update screen
     3989                        jQuery( '#sui-box-stripe' ).html( result.data );
     3990
     3991                        // Re-init SUI events
     3992                        Forminator.Utils.sui_delegate_events();
     3993
     3994                        // Close the popup
     3995                        Forminator.Stripe_Popup.close();
     3996                    });
     3997            },
     3998
     3999            show_unsupported_settings: function (e) {
     4000                e.preventDefault();
     4001
     4002                $('.forminator-unsupported-settings').show();
     4003            },
     4004
     4005            hide_unsupported_settings: function (e) {
     4006                e.preventDefault();
     4007
     4008                $('.forminator-unsupported-settings').hide();
     4009            },
     4010
     4011            connect_stripe: function (e) {
     4012                e.preventDefault();
     4013
     4014                var $target = $(e.target);
     4015                $target.addClass('sui-button-onload');
     4016
     4017                var nonce        = $target.data('nonce');
     4018                var popup        = this.$el.find('#forminator-stripe-popup');
     4019                var form         = popup.find('form');
     4020                var data         = form.serializeArray();
     4021                var indexedArray = {};
     4022
     4023                $.map(data, function (n, i) {
     4024                    indexedArray[n['name']] = n['value'];
     4025                });
     4026                indexedArray['connect'] = true;
     4027
     4028                this.render_stripe_connect_modal_content(popup, nonce, indexedArray);
     4029
     4030                return false;
     4031            },
     4032
     4033            connect_addon: function (e) {
     4034                e.preventDefault();
     4035
     4036                var $target = $(e.target);
     4037                $target.addClass('sui-button-onload');
     4038
     4039                var nonce        = $target.data('nonce');
     4040                var popup        = this.$el.find('#forminator-stripe-popup');
     4041                var form         = popup.find('form');
     4042                var addonSlug    = form.data('slug');
     4043                var data         = form.serializeArray();
     4044                var indexedArray = {};
     4045
     4046                $.map(data, function (n, i) {
     4047                    indexedArray[n['name']] = n['value'];
     4048                });
     4049                indexedArray['connect'] = true;
     4050
     4051                this.render_connect_modal_content(addonSlug, popup, nonce, indexedArray);
     4052
     4053                return false;
     4054            },
     4055
     4056            /**
     4057             * WAI-ARIA Side Tabs
     4058             *
     4059             * @since 1.7.2
     4060             */
     4061            buttonTabs: function( e ) {
     4062
     4063                var button = this.$( e.target ),
     4064                    wrapper = button.closest( '.sui-tabs' ),
     4065                    list    = wrapper.find( '.sui-tabs-menu .sui-tab-item' ),
     4066                    panes   = wrapper.find( '.sui-tabs-content .sui-tab-content' )
     4067                    ;
     4068
     4069                if ( button.is( 'button' ) ) {
     4070
     4071                    // Reset lists
     4072                    list.removeClass( 'active' );
     4073                    list.attr( 'tabindex', '-1' );
     4074
     4075                    // Reset panes
     4076                    panes.attr( 'hidden', true );
     4077                    panes.removeClass('active');
     4078
     4079                    // Select current tab
     4080                    button.removeAttr( 'tabindex' );
     4081                    button.addClass( 'active' );
     4082
     4083                    // Select current content
     4084                    wrapper.find( '#' + button.attr( 'aria-controls' ) ).addClass( 'active' );
     4085                    wrapper.find( '#' + button.attr( 'aria-controls' ) ).attr( 'hidden', false );
     4086                    wrapper.find( '#' + button.attr( 'aria-controls' ) ).removeAttr( 'hidden' );
     4087                }
     4088
     4089                e.preventDefault();
     4090
     4091            },
     4092
     4093            /**
     4094             * Open addon connection modal
     4095             *
     4096             * @since 1.26
     4097             */
     4098            open_connect_modal: function ( e, addonSlug ) {
     4099                e.preventDefault();
     4100                var self = this;
     4101                var $target = $(e.target);
     4102                var nonce    = $target.data('modalNonce');
     4103                Forminator.Stripe_Popup.open(function () {
     4104                    var popup = $(this);
     4105                    self.render_connect_modal_content( addonSlug, popup, nonce, {});
     4106                }, {
     4107                    title: forminatorl10n[ addonSlug ].configure_title,
     4108                    image: forminatorData.imagesUrl + '/' + addonSlug + '-logo.png',
     4109                    image_x2: forminatorData.imagesUrl + '/' + addonSlug + '-logo@2x.png',
     4110                });
     4111
     4112                return false;
     4113            },
     4114
     4115            render_connect_modal_content: function (addonSlug, popup, popup_nonce, request_data) {
     4116                var self = this;
     4117                request_data.action      = 'forminator_' + addonSlug + '_settings_modal';
     4118                request_data._ajax_nonce = popup_nonce;
     4119
     4120                var preloader =
     4121                    '<p class="fui-loading-modal">' +
     4122                    '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' +
     4123                    '</p>'
     4124                ;
     4125
     4126                popup.find('.sui-box-body').html(preloader);
     4127
     4128                $.post({
     4129                    url: Forminator.Data.ajaxUrl,
     4130                    type: 'post',
     4131                    data: request_data
     4132                })
     4133                .done(function (result) {
     4134                    if (result && result.success) {
     4135                        // Imitate title loading
     4136                        popup.find('.sui-box-header h3.sui-box-title').show();
     4137
     4138                        // Render popup body
     4139                        popup.find('.sui-box-body').html(result.data.html);
     4140
     4141                        // Render popup footer
     4142                        var buttons = result.data.buttons;
     4143
     4144                        // Clear footer from previous buttons
     4145                        popup.find('.sui-box-footer').html('');
     4146
     4147                        // Append buttons
     4148                        _.each( buttons, function( button ) {
     4149                            popup.find( '.sui-box-footer' ).append( button.markup );
     4150                        });
     4151
     4152                        popup.find(".sui-button").removeClass("sui-button-onload");
     4153
     4154                        // Handle notifications
     4155                        if ( result.data.notification ) {
     4156                            self.openNotificaion( result.data.notification );
     4157                            self.closePopup();
     4158                        }
     4159                    } else {
     4160                        Forminator.Notification.open( 'error', result.data );
     4161                        self.closePopup();
     4162                    }
     4163                });
     4164            },
     4165
     4166            closePopup: function() {
     4167                // Re-init SUI events
     4168                Forminator.Utils.sui_delegate_events();
     4169
     4170                // Close the popup
     4171                Forminator.Stripe_Popup.close();
     4172            },
     4173
     4174            // Handle notifications
     4175            openNotificaion: function( notification ) {
     4176                if ( ! _.isUndefined( notification ) &&
     4177                    ! _.isUndefined( notification.type ) &&
     4178                    ! _.isUndefined( notification.text ) &&
     4179                    ! _.isUndefined( notification.duration )
     4180                ) {
     4181                    Forminator.Notification.open( notification.type,  notification.text, notification.duration )
     4182                        .done(function () {
     4183                            // Notification opened
     4184                        });
     4185                }
     4186            },
     4187
     4188            /**
     4189             * Paypal
     4190             *
     4191             * @param {*} e
     4192             * @since 1.7.1
     4193             */
     4194            open_paypal_connect_modal: function (e) {
     4195                e.preventDefault();
     4196                var self = this;
     4197                var $target = $(e.target);
     4198                var image    = $target.data('modalImage');
     4199                var image_x2 = $target.data('modalImageX2');
     4200                var title    = $target.data('modalTitle');
     4201                var nonce    = $target.data('modalNonce');
     4202                Forminator.Stripe_Popup.open(function () {
     4203                    var popup = $(this);
     4204                    self.render_paypal_connect_modal_content(popup, nonce, {});
     4205                }, {
     4206                    title: Forminator.Utils.sanitize_text_field( title ),
     4207                    image: image,
     4208                    image_x2: image_x2,
     4209                });
     4210
     4211                return false;
     4212            },
     4213
     4214            render_paypal_connect_modal_content: function (popup, popup_nonce, request_data) {
     4215                var self = this;
     4216                request_data.action      = 'forminator_paypal_settings_modal';
     4217                request_data._ajax_nonce = popup_nonce;
     4218
     4219                $.post({
     4220                    url: Forminator.Data.ajaxUrl,
     4221                    type: 'post',
     4222                    data: request_data
     4223                })
     4224                    .done(function (result) {
     4225                        if (result && result.success) {
     4226                            // Imitate title loading
     4227                            popup.find(".sui-box-header h3.sui-box-title").show();
     4228
     4229                            // Render popup body
     4230                            popup.find(".sui-box-body").html(result.data.html);
     4231
     4232                            // Render popup footer
     4233                            var buttons = result.data.buttons;
     4234
     4235                            // Clear footer from previous buttons
     4236                            popup.find(".sui-box-footer").html('');
     4237
     4238                            // Append buttons
     4239                            _.each( buttons, function( button ) {
     4240                                popup.find( '.sui-box-footer' ).append( button.markup );
     4241                            });
     4242
     4243                            popup.find(".sui-button").removeClass("sui-button-onload");
     4244
     4245                            // Handle notifications
     4246                            if (!_.isUndefined(result.data.notification) &&
     4247                                !_.isUndefined(result.data.notification.type) &&
     4248                                !_.isUndefined(result.data.notification.text) &&
     4249                                !_.isUndefined(result.data.notification.duration)
     4250                            ) {
     4251
     4252                                Forminator.Notification.open(result.data.notification.type, result.data.notification.text, result.data.notification.duration)
     4253                                    .done(function () {
     4254                                        // Notification opened
     4255                                    });
     4256
     4257                                self.update_paypal_page( popup_nonce );
     4258                            }
     4259                        }
     4260                    });
     4261            },
     4262
     4263            update_paypal_page: function( nonce ) {
     4264                var new_request = {
     4265                    action: 'forminator_paypal_update_page',
     4266                    _ajax_nonce: nonce,
     4267                }
     4268
     4269                $.post({
     4270                    url: Forminator.Data.ajaxUrl,
     4271                    type: 'get',
     4272                    data: new_request
     4273                })
     4274                    .done(function (result) {
     4275                        // Update screen
     4276                        jQuery( '#sui-box-paypal' ).html( result.data );
     4277
     4278                        // Re-init SUI events
     4279                        Forminator.Utils.sui_delegate_events();
     4280
     4281                        // Close the popup
     4282                        Forminator.Stripe_Popup.close();
     4283                    });
     4284            },
     4285
     4286            connect_paypal: function (e) {
     4287                e.preventDefault();
     4288
     4289                var $target = $(e.target);
     4290                $target.addClass('sui-button-onload');
     4291
     4292                var nonce        = $target.data('nonce');
     4293                var popup        = this.$el.find('#forminator-stripe-popup');
     4294                var form         = popup.find('form');
     4295                var data         = form.serializeArray();
     4296                var indexedArray = {};
     4297
     4298                $.map(data, function (n, i) {
     4299                    indexedArray[n['name']] = n['value'];
     4300                });
     4301                indexedArray['connect'] = true;
     4302
     4303                this.render_paypal_connect_modal_content(popup, nonce, indexedArray);
     4304
     4305                return false;
     4306            },
     4307
     4308            disconnect_stripe: function (e) {
     4309                var $target = $(e.target);
     4310                var new_request = {
     4311                    action: 'forminator_disconnect_stripe',
     4312                    _ajax_nonce: $target.data('nonce'),
     4313                }
     4314                $target.addClass('sui-button-onload');
     4315
     4316                $.post({
     4317                    url: Forminator.Data.ajaxUrl,
     4318                    type: 'get',
     4319                    data: new_request
     4320                })
     4321                    .done(function (result) {
     4322                        // Update screen
     4323                        jQuery( '#sui-box-stripe' ).html( result.data.html );
     4324
     4325                        // Re-init SUI events
     4326                        Forminator.Utils.sui_delegate_events();
     4327
     4328                        // Close the popup
     4329                        Forminator.Stripe_Popup.close();
     4330
     4331                        // Handle notifications
     4332                        if (!_.isUndefined(result.data.notification) &&
     4333                            !_.isUndefined(result.data.notification.type) &&
     4334                            !_.isUndefined(result.data.notification.text) &&
     4335                            !_.isUndefined(result.data.notification.duration)
     4336                        ) {
     4337
     4338                            Forminator.Notification.open(result.data.notification.type, result.data.notification.text, result.data.notification.duration)
     4339                                .done(function () {
     4340                                    // Notification opened
     4341                                });
     4342
     4343                        }
     4344                    });
     4345
     4346            },
     4347
     4348            disconnect_paypal: function (e) {
     4349                var $target = $(e.target);
     4350                var new_request = {
     4351                    action: 'forminator_disconnect_paypal',
     4352                    _ajax_nonce: $target.data('nonce'),
     4353                }
     4354                $target.addClass('sui-button-onload');
     4355
     4356                $.post({
     4357                    url: Forminator.Data.ajaxUrl,
     4358                    type: 'get',
     4359                    data: new_request
     4360                })
     4361                    .done(function (result) {
     4362                        // Update screen
     4363                        jQuery( '#sui-box-paypal' ).html( result.data.html );
     4364
     4365                        // Re-init SUI events
     4366                        Forminator.Utils.sui_delegate_events();
     4367
     4368                        // Close the popup
     4369                        Forminator.Stripe_Popup.close();
     4370
     4371                        // Handle notifications
     4372                        if (!_.isUndefined(result.data.notification) &&
     4373                            !_.isUndefined(result.data.notification.type) &&
     4374                            !_.isUndefined(result.data.notification.text) &&
     4375                            !_.isUndefined(result.data.notification.duration)
     4376                        ) {
     4377
     4378                            Forminator.Notification.open(result.data.notification.type, result.data.notification.text, result.data.notification.duration)
     4379                                .done(function () {
     4380                                    // Notification opened
     4381                                });
     4382
     4383                        }
     4384                    });
     4385
     4386            },
     4387
     4388            show_custom_directory: function (e) {
     4389                var $target = $(e.target),
     4390                directoryValue = $target.val();
     4391                $('.forminator-custom-directory strong').html( directoryValue );
     4392            }
     4393
     4394        });
     4395
     4396        var SettingsPage = new SettingsPage();
     4397
     4398        return SettingsPage;
     4399    });
     4400})(jQuery);
     4401
     4402// noinspection JSUnusedGlobalSymbols
     4403var forminator_render_admin_captcha = function () {
     4404    setTimeout( function () {
     4405        var $captcha = jQuery( '.forminator-g-recaptcha' ),
     4406            sitekey = $captcha.data('sitekey'),
     4407            theme = $captcha.data('theme'),
     4408            size = $captcha.data('size')
     4409        ;
     4410        window.grecaptcha.render( $captcha[0], {
     4411            sitekey: sitekey,
     4412            theme: theme,
     4413            size: size
     4414        } );
     4415    }, 100 );
     4416};
     4417
     4418// noinspection JSUnusedGlobalSymbols
     4419var forminator_render_admin_captcha_v2 = function () {
     4420    setTimeout( function () {
     4421        var $captcha_v2 = jQuery( '.forminator-g-recaptcha-v2' ),
     4422            sitekey_v2 = $captcha_v2.data('sitekey'),
     4423            theme_v2 = $captcha_v2.data('theme'),
     4424            size_v2 = $captcha_v2.data('size')
     4425        ;
     4426        window.grecaptcha.render( $captcha_v2[0], {
     4427            sitekey: sitekey_v2,
     4428            theme: theme_v2,
     4429            size: size_v2
     4430        } );
     4431    }, 100 );
     4432};
     4433
     4434// noinspection JSUnusedGlobalSymbols
     4435var forminator_render_admin_captcha_v2_invisible = function () {
     4436    setTimeout( function () {
     4437        var $captcha = jQuery( '.forminator-g-recaptcha-v2-invisible' ),
     4438            sitekey = $captcha.data('sitekey'),
     4439            theme = $captcha.data('theme'),
     4440            size = $captcha.data('size')
     4441        ;
     4442        window.grecaptcha.render( $captcha[0], {
     4443            sitekey: sitekey,
     4444            theme: theme,
     4445            size: size,
     4446            badge: 'inline'
     4447        } );
     4448    }, 100 );
     4449};
     4450
     4451var forminator_render_admin_captcha_v3 = function () {
     4452    setTimeout( function () {
     4453        var $captcha = jQuery( '.forminator-g-recaptcha-v3' ),
     4454            sitekey = $captcha.data('sitekey'),
     4455            theme = $captcha.data('theme'),
     4456            size = $captcha.data('size')
     4457        ;
     4458        window.grecaptcha.render( $captcha[0], {
     4459            sitekey: sitekey,
     4460            theme: theme,
     4461            size: size,
     4462            badge: 'inline'
     4463        } );
     4464    }, 100 );
     4465};
     4466
     4467var forminator_render_admin_hcaptcha = function () {
     4468    setTimeout( function () {
     4469        var $hcaptcha = jQuery( '.forminator-hcaptcha' ),
     4470            sitekey = $hcaptcha.data( 'sitekey' )
     4471            // theme = $captcha.data('theme'),
     4472            // size = $captcha.data('size')
     4473        ;
     4474
     4475        hcaptcha.render( $hcaptcha[0], {
     4476            sitekey: sitekey
     4477        } );
     4478    }, 1000 );
     4479};
     4480
     4481
     4482formintorjs.define('text!tpl/dashboard.html',[],function () { return '<div>\r\n\r\n\t<!-- TEMPLATE: Delete -->\r\n\t<script type="text/template" id="forminator-delete-popup-tpl">\r\n\r\n\t    <div class="sui-box-body sui-spacing-top--0">\r\n\t\t    <p id="forminator-popup__description" class="sui-description" style="margin: 5px 0 0; text-align: center;">{{ content }}</p>\r\n\t    </div>\r\n\r\n\t    <div class="sui-box-footer sui-flatten sui-content-center sui-spacing-top--10">\r\n\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<form method="post" class="delete-action">\r\n\r\n\t\t\t\t<input type="hidden" name="forminator_action" value="{{ action }}">\r\n\t\t\t\t<input type="hidden" name="id" value="{{ id }}">\r\n\t\t\t\t<input type="hidden" id="forminatorNonce" name="forminatorNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" id="forminatorEntryNonce" name="forminatorEntryNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" name="_wp_http_referer" value="{{ referrer }}">\r\n\r\n\t\t\t\t<button type="submit" class="sui-button sui-button-ghost sui-button-red popup-confirmation-confirm" style="margin: 0;">\r\n\t\t\t\t\t<span class="sui-icon-trash" aria-hidden="true"></span>\r\n\t\t\t\t\t{{ button }}\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</form>\r\n\r\n\t    </div>\r\n\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Create New Form (Base Structure) -->\r\n\t<script type="text/template" id="forminator-new-form-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ Forminator.l10n.popup.enter_name }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-content-center sui-spacing-top--10"></div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button id="forminator-build-your-form" class="sui-button sui-button-blue">\r\n\t\t\t\t\t<span class="sui-loading-text">\r\n\t\t\t\t\t\t<i class="sui-icon-plus" aria-hidden="true"></i>\r\n\t\t\t\t\t\t{{Forminator.l10n.popup.create}}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Create New Form (Content) -->\r\n\t<script type="text/template" id="forminator-new-form-content-tpl">\r\n\r\n\t\t<p id="forminator-popup__description" class="sui-description">{{ Forminator.l10n.popup.new_form_desc2 }}</p>\r\n\r\n\t\t<div\r\n\t\t\trole="alert"\r\n\t\t\tid="forminator-template-register-notice"\r\n\t\t\tclass="sui-notice sui-notice-blue"\r\n\t\t\taria-live="assertive"\r\n\t\t>\r\n\r\n\t\t\t<div class="sui-notice-content">\r\n\r\n\t\t\t\t<div class="sui-notice-message">\r\n\r\n\t\t\t\t\t<span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\r\n\r\n\t\t\t\t\t<p style="text-align: left;">{{ Forminator.l10n.popup.registration_notice }}</p>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div\r\n\t\t\trole="alert"\r\n\t\t\tid="forminator-template-login-notice"\r\n\t\t\tclass="sui-notice sui-notice-blue"\r\n\t\t\taria-live="assertive"\r\n\t\t>\r\n\r\n\t\t\t<div class="sui-notice-content">\r\n\r\n\t\t\t\t<div class="sui-notice-message">\r\n\r\n\t\t\t\t\t<span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\r\n\r\n\t\t\t\t\t<p style="text-align: left;">{{ Forminator.l10n.popup.login_notice }}</p>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div id="forminator-form-name-input" class="sui-form-field">\r\n\r\n\t\t\t<label for="forminator-form-name" class="sui-screen-reader-text">{{ Forminator.l10n.popup.input_label }}</label>\r\n\t\t\t<input type="text"\r\n\t\t\t       id="forminator-form-name"\r\n\t\t\t       class="sui-form-control fui-required"\r\n\t\t\t       placeholder="{{Forminator.l10n.popup.new_form_placeholder}}" autofocus>\r\n\t\t\t<span class="sui-error-message" style="display: none;">{{Forminator.l10n.popup.form_name_validation}}</span>\r\n\r\n\t\t</div>\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Create Poll -->\r\n\t<script type="text/template" id="forminator-new-poll-content-tpl">\r\n\t\t<p class="sui-description" style="text-align: center;">{{ Forminator.l10n.popup.new_poll_desc2 }}</p>\r\n\r\n\t\t<div id="forminator-form-name-input" class="sui-form-field">\r\n\r\n\t\t\t<label for="forminator-form-name" class="sui-screen-reader-text">{{ Forminator.l10n.popup.input_label }}</label>\r\n\t\t\t<input type="text"\r\n\t\t\t       id="forminator-form-name"\r\n\t\t\t       class="sui-form-control fui-required"\r\n\t\t\t       placeholder="{{Forminator.l10n.popup.new_poll_placeholder}}" autofocus>\r\n\t\t\t<span class="sui-error-message" style="display: none;">{{Forminator.l10n.popup.poll_name_validation}}</span>\r\n\r\n\t\t</div>\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Create Quiz, Step 1 -->\r\n\t<script type="text/template" id="forminator-quizzes-popup-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg" style="overflow: initial; white-space: initial; text-overflow: none;">{{ Forminator.l10n.quiz.choose_quiz_title }}</h3>\r\n\r\n\t\t\t<p id="forminator-popup__description" class="sui-description">{{ Forminator.l10n.quiz.choose_quiz_description }}</p>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-content-center sui-spacing-bottom--10">\r\n\r\n\t\t\t<div id="forminator-form-name-input" class="sui-form-field">\r\n\r\n\t\t\t\t<label for="forminator-form-name" class="sui-label">{{ Forminator.l10n.quiz.quiz_name }}</label>\r\n\r\n\t\t\t\t<input\r\n\t\t\t\t\ttype="text"\r\n\t\t\t\t\tid="forminator-form-name"\r\n\t\t\t\t\tclass="sui-form-control fui-required"\r\n\t\t\t\t\tplaceholder="{{Forminator.l10n.popup.new_quiz_placeholder}}"\r\n\t\t\t\t\tautofocus\r\n\t\t\t\t/>\r\n\t\t\t\t<span class="sui-error-message" style="display: none;">{{Forminator.l10n.popup.quiz_name_validation}}</span>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t\t<label class="sui-label">{{ Forminator.l10n.quiz.quiz_type }}</label>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-selectors" style="margin: 0;">\r\n\r\n\t\t\t<ul>\r\n\r\n\t\t\t\t<li><label for="forminator-new-quiz--knowledge" class="sui-box-selector">\r\n\t\t\t\t\t<input\r\n\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\tname="forminator-new-quiz"\r\n\t\t\t\t\t\tid="forminator-new-quiz--knowledge"\r\n\t\t\t\t\t\tclass="forminator-new-quiz-type"\r\n\t\t\t\t\t\tvalue="knowledge"\r\n\t\t\t\t\t\tchecked="checked"\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<span>\r\n\t\t\t\t\t\t<i class="sui-icon-academy" aria-hidden="true"></i>\r\n\t\t\t\t\t\t{{ Forminator.l10n.quiz.knowledge_label }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<span>{{ Forminator.l10n.quiz.knowledge_description }}</span>\r\n\t\t\t\t</label></li>\r\n\r\n\t\t\t\t<li><label for="forminator-new-quiz--nowrong" class="sui-box-selector">\r\n\t\t\t\t\t<input\r\n\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\tname="forminator-new-quiz"\r\n\t\t\t\t\t\tid="forminator-new-quiz--nowrong"\r\n\t\t\t\t\t\tclass="forminator-new-quiz-type"\r\n\t\t\t\t\t\tvalue="nowrong"\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<span>\r\n\t\t\t\t\t\t<i class="sui-icon-community-people" aria-hidden="true"></i>\r\n\t\t\t\t\t\t{{ Forminator.l10n.quiz.nowrong_label }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<span>{{ Forminator.l10n.quiz.nowrong_description }}</span>\r\n\t\t\t\t</label></li>\r\n\r\n\t\t\t</ul>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-spacing-top--30">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button select-quiz-template">\r\n\t\t\t\t\t<span class="sui-loading-text">{{ Forminator.l10n.quiz.continue_button }}</span>\r\n\t\t\t\t\t<i class="sui-icon-load sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Create Quiz, Step 2 (Pagination) -->\r\n\t<script type="text/template" id="forminator-new-quiz-pagination-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--left forminator-popup-back">\r\n\t\t\t\t<span class="sui-icon-chevron-left sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.go_back }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close">\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg" style="overflow: initial; text-overflow: none; white-space: initial;">{{ Forminator.l10n.quiz.quiz_pagination }}</h3>\r\n\r\n\t\t\t<p id="forminator-popup__description" class="sui-description">\r\n\t\t\t\t{{ Forminator.l10n.quiz.quiz_pagination_descr }}<br>\r\n\t\t\t\t{{ Forminator.l10n.quiz.quiz_pagination_descr2 }}\r\n\t\t\t</p>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-spacing-bottom--10">\r\n\r\n\t\t\t<label class="sui-label">{{ Forminator.l10n.quiz.presentation }}</label>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-selectors" style="margin: 0;">\r\n\r\n\t\t\t<ul>\r\n\r\n\t\t\t\t<li><label class="sui-box-selector">\r\n\t\t\t\t\t<input\r\n\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\tname="forminator-quiz-pagination"\r\n\t\t\t\t\t\tvalue="0"\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<span>\r\n\t\t\t\t\t\t{{ Forminator.l10n.quiz.no_pagination }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</label></li>\r\n\r\n\t\t\t\t<li><label class="sui-box-selector">\r\n\t\t\t\t\t<input\r\n\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\tname="forminator-quiz-pagination"\r\n\t\t\t\t\t\tvalue="1"\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<span>\r\n\t\t\t\t\t\t{{ Forminator.l10n.quiz.paginate_quiz }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t</label></li>\r\n\r\n\t\t\t</ul>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-spacing-top--30">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button select-quiz-pagination">\r\n\t\t\t\t\t<span class="sui-loading-text">{{ Forminator.l10n.quiz.continue_button }}</span>\r\n\t\t\t\t\t<i class="sui-icon-load sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Create Quiz, Step 3A (Leads Base Structure) -->\r\n\t<script type="text/template" id="forminator-new-quiz-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--left forminator-popup-back">\r\n\t\t\t\t<span class="sui-icon-chevron-left sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.go_back }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close forminator-cancel-create-form">\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ Forminator.l10n.quiz.collect_leads }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10"></div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-separated">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button id="forminator-build-your-form" class="sui-button sui-button-blue">\r\n\t\t\t\t\t<span class="sui-loading-text">\r\n\t\t\t\t\t\t<i class="sui-icon-plus" aria-hidden="true"></i> {{ Forminator.l10n.quiz.create_quiz }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Create Quiz, Step 3B (Leads Content) -->\r\n\t<script type="text/template" id="forminator-new-quiz-content-tpl">\r\n\r\n\t\t<p class="sui-description" style="text-align: center;">{{ Forminator.l10n.popup.new_quiz_desc2 }}\r\n\t\t\t{[ if( Forminator.Data.showDocLink ) { ]}\r\n\t\t\t\t<a href="https://wpmudev.com/docs/wpmu-dev-plugins/forminator/?utm_source=forminator&utm_medium=plugin&utm_campaign=capture_leads_learnmore_link#leads" target="_blank">\r\n\t\t\t\t\t{{ Forminator.l10n.popup.learn_more }}\r\n\t\t\t\t</a>\r\n\t\t\t{[ } ]}\r\n\t\t</p>\r\n\r\n\t\t<div class="sui-form-field">\r\n\r\n\t\t\t<label for="forminator-new-quiz-leads" class="sui-toggle fui-highlighted-toggle">\r\n\r\n\t\t\t\t<input\r\n\t\t\t\t\ttype="checkbox"\r\n\t\t\t\t\tid="forminator-new-quiz-leads"\r\n\t\t\t\t\taria-labelledby="forminator-new-quiz-leads-label"\r\n\t\t\t\t/>\r\n\r\n\t\t\t\t<span class="sui-toggle-slider" aria-hidden="true"></span>\r\n\r\n\t\t\t\t<span id="forminator-new-quiz-leads-label" class="sui-toggle-label">{{ Forminator.l10n.quiz.quiz_leads_toggle }}</span>\r\n\r\n\t\t\t</label>\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="alert"\r\n\t\t\t\tid="sui-quiz-leads-description"\r\n\t\t\t\tclass="sui-notice sui-notice-blue"\r\n\t\t\t\taria-live="assertive"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-notice-content">\r\n\r\n\t\t\t\t\t<div class="sui-notice-message">\r\n\r\n\t\t\t\t\t\t<span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\r\n\r\n\t\t\t\t\t\t<p>{{ Forminator.l10n.quiz.quiz_leads_desc }}</p>\r\n\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Export Schedule (on Submissions page) -->\r\n\t<script type="text/template" id="forminator-exports-schedule-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\r\n\t\t\t<div class="sui-box-settings-row">\r\n\r\n\t\t\t\t<div class="sui-box-settings-col-2">\r\n\r\n\t\t\t\t\t<span class="sui-settings-label sui-dark">{{ Forminator.l10n.popup.manual_exports }}</span>\r\n\t\t\t\t\t<span class="sui-description">{{ Forminator.l10n.popup.manual_description }}</span>\r\n\r\n\t\t\t\t\t<form method="post" style="margin-top: 10px;">\r\n\r\n\t\t\t\t\t\t<input type="hidden" name="forminator_export" value="1" />\r\n\t\t\t\t\t\t<input type="hidden" name="form_id" value="{{ Forminator.l10n.exporter.form_id }}" />\r\n\t\t\t\t\t\t<input type="hidden" name="form_type" value="{{ Forminator.l10n.exporter.form_type }}" />\r\n\t\t\t\t\t\t<input type="hidden" name="_forminator_nonce" value="{{ Forminator.l10n.exporter.export_nonce }}" />\r\n\r\n\t\t\t\t\t\t<button class="sui-button sui-button-ghost">{{ Forminator.l10n.popup.download_csv }}</button>\r\n\r\n\t\t\t\t\t\t{[ if( \'cform\' === Forminator.l10n.exporter.form_type || \'quiz\' === Forminator.l10n.exporter.form_type ) { ]}\r\n\t\t\t\t\t\t\t<label for="apply-submission-filter" class="sui-checkbox sui-checkbox-sm sui-checkbox-stacked" style="margin-top: 20px;">\r\n\t\t\t\t\t\t\t\t<input type="checkbox" name="submission-filter" id="apply-submission-filter" value="yes" />\r\n\t\t\t\t\t\t\t\t<span aria-hidden="true"></span>\r\n\t\t\t\t\t\t\t\t<span>{{ Forminator.l10n.popup.apply_submission_filter }}</span>\r\n\t\t\t\t\t\t\t</label>\r\n\t\t\t\t\t\t{[ } ]}\r\n\r\n\t\t\t\t\t</form>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t\t<form method="post" class="sui-box-settings-row schedule-action">\r\n\r\n\t\t\t\t<div class="sui-box-settings-col-2">\r\n\r\n\t\t\t\t\t<span class="sui-settings-label sui-dark">{{ Forminator.l10n.popup.scheduled_exports }}</span>\r\n\t\t\t\t\t<span class="sui-description">{{ Forminator.l10n.popup.scheduled_description }}</span>\r\n\r\n\t\t\t\t\t<div class="sui-side-tabs" style="margin-top: 10px;">\r\n\r\n\t\t\t\t\t\t<div class="sui-tabs-menu tab-labels">\r\n\r\n\t\t\t\t\t\t\t<label for="forminator-disable-scheduled-exports" class="sui-tab-item tab-label-disable">\r\n\t\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\t\t\t\tname="enabled"\r\n\t\t\t\t\t\t\t\t\tvalue="false"\r\n\t\t\t\t\t\t\t\t\tid="forminator-disable-scheduled-exports"\r\n\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t{{ Forminator.l10n.popup.disable }}\r\n\t\t\t\t\t\t\t</label>\r\n\r\n\t\t\t\t\t\t\t<label for="forminator-enable-scheduled-exports" class="sui-tab-item tab-label-enable">\r\n\t\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\t\t\t\tname="enabled"\r\n\t\t\t\t\t\t\t\t\tvalue="true"\r\n\t\t\t\t\t\t\t\t\tid="forminator-enable-scheduled-exports"\r\n\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t{{ Forminator.l10n.popup.enable }}\r\n\t\t\t\t\t\t\t</label>\r\n\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t<div class="sui-tabs-content schedule-enabled">\r\n\r\n\t\t\t\t\t\t\t<div id="forminator-export-schedule-timeframe" class="sui-tab-content sui-tab-boxed active">\r\n\r\n\t\t\t\t\t\t\t\t<div class="sui-row">\r\n\r\n\t\t\t\t\t\t\t\t\t<div class="sui-col-md-6">\r\n\r\n\t\t\t\t\t\t\t\t\t\t<div class="sui-form-field">\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.frequency }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t<select name="interval" class="sui-select">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="daily">{{ Forminator.l10n.popup.daily }}</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="weekly">{{ Forminator.l10n.popup.weekly }}</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="monthly">{{ Forminator.l10n.popup.monthly }}</option>\r\n\t\t\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t<div class="sui-col-md-6">\r\n\r\n\t\t\t\t\t\t\t\t\t\t<div class="sui-form-field">\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.day_time }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t<select name="hour" class="sui-select">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="00:00">12:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="01:00">01:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="02:00">02:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="03:00">03:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="04:00">04:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="05:00">05:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="06:00">06:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="07:00">07:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="08:00">08:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="09:00">09:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="10:00">10:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="11:00">11:00 AM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="12:00">12:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="13:00">01:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="14:00">02:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="15:00">03:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="16:00">04:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="17:00">05:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="18:00">06:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="19:00">07:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="20:00">08:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="21:00">09:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="22:00">10:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<option value="23:00">11:00 PM</option>\r\n\t\t\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t<div class="sui-form-field">\r\n\r\n\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.week_day }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t<select name="day" class="sui-select">\r\n\t\t\t\t\t\t\t\t\t\t<option value="mon">{{ Forminator.l10n.popup.monday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="tue">{{ Forminator.l10n.popup.tuesday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="wed">{{ Forminator.l10n.popup.wednesday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="thu">{{ Forminator.l10n.popup.thursday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="fri">{{ Forminator.l10n.popup.friday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="sat">{{ Forminator.l10n.popup.saturday }}</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="sun">{{ Forminator.l10n.popup.sunday }}</option>\r\n\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t<div class="sui-form-field">\r\n\r\n\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.day_month }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t<select name="month_day" class="sui-select">\r\n\t\t\t\t\t\t\t\t\t\t<option value="1">1</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="2">2</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="3">3</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="4">4</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="5">5</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="6">6</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="7">7</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="8">8</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="9">9</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="10">10</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="11">11</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="12">12</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="13">13</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="14">14</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="15">15</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="16">16</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="17">17</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="18">18</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="19">19</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="20">20</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="21">21</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="22">22</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="23">23</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="24">24</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="25">25</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="26">26</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="27">27</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="28">28</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="29">29</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="30">30</option>\r\n\t\t\t\t\t\t\t\t\t\t<option value="31">31</option>\r\n\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t<div id="forminator-export-schedule-email" class="sui-form-field" style="margin-bottom: 20px;">\r\n\r\n\t\t\t\t\t\t\t\t\t<label class="sui-label">{{ Forminator.l10n.popup.email_to }}</label>\r\n\r\n\t\t\t\t\t\t\t\t\t<select name="email[]" class="sui-select fui-multi-select wpmudev-select" multiple="multiple">\r\n\t\t\t\t\t\t\t\t\t\t{[ _.each( Forminator.l10n.exporter.email, function ( email ) { ]}\r\n\t\t\t\t\t\t\t\t\t\t<option value="{{ email }}" selected="selected">{{ email }}</option>\r\n\t\t\t\t\t\t\t\t\t\t{[ }) ]}\r\n\t\t\t\t\t\t\t\t\t</select>\r\n\r\n\t\t\t\t\t\t\t\t\t<input type="hidden" name="form_id" value="{{ Forminator.l10n.exporter.form_id }}"/>\r\n\t\t\t\t\t\t\t\t\t<input type="hidden" name="form_type" value="{{ Forminator.l10n.exporter.form_type }}"/>\r\n\t\t\t\t\t\t\t\t\t<input type="hidden" name="action" value="forminator_export_entries"/>\r\n\t\t\t\t\t\t\t\t\t<input type="hidden" name="_forminator_nonce" value="{{ Forminator.l10n.exporter.export_nonce }}"/>\r\n\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t<label for="forminator-send-if-new-exports" class="sui-checkbox sui-checkbox-sm sui-checkbox-stacked">\r\n\t\t\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\t\t\ttype="checkbox"\r\n\t\t\t\t\t\t\t\t\t\tname="if_new"\r\n\t\t\t\t\t\t\t\t\t\tvalue="true"\r\n\t\t\t\t\t\t\t\t\t\tid="forminator-send-if-new-exports"\r\n\t\t\t\t\t\t\t\t\t\tclass="forminator-field-singular"\r\n\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t\t<span aria-hidden="true"></span>\r\n\t\t\t\t\t\t\t\t\t<span class="sui-description">{{ Forminator.l10n.popup.scheduled_export_if_new }}</span>\r\n\t\t\t\t\t\t\t\t</label>\r\n\r\n\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t</form>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer">\r\n\r\n\t\t\t<button class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide="forminator-popup">{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button type="submit" class="sui-button wpmudev-action-done">{{ Forminator.l10n.popup.save }}</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Reset Plugin (on Settings page) -->\r\n\t<script type="text/template" id="forminator-reset-plugin-settings-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10">\r\n\t\t\t<p class="sui-description" style="text-align: center;">{{ content }}</p>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<form method="post" class="delete-action">\r\n\t\t\t\t<input type="hidden" name="forminator_action" value="reset_plugin_settings">\r\n\t\t\t\t<input type="hidden" id="forminatorNonce" name="forminatorNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" name="_wp_http_referer" value="{{ referrer }}&forminator_notice=settings_reset">\r\n\t\t\t\t<button type="submit" class="sui-button sui-button-ghost sui-button-red popup-confirmation-confirm">\r\n\t\t\t\t\t<span class="sui-loading-text" aria-hidden="true">\r\n\t\t\t\t\t\t<i class="sui-icon-refresh" aria-hidden="true"></i>\r\n\t\t\t\t\t\t{{ Forminator.l10n.popup.reset }}\r\n\t\t\t\t\t</span>\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\t\t\t</form>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Disconnect PayPal (on Settings page) -->\r\n\t<script type="text/template" id="forminator-disconnect-paypal-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10">\r\n\t\t\t<p class="sui-description" style="text-align: center;">{{ content }}</p>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<button type="submit" class="disconnect_paypal sui-button sui-button-ghost sui-button-red popup-confirmation-confirm" data-nonce="{{ nonce }}" data-action="disconnect_paypal">\r\n\t\t\t\t{{ Forminator.l10n.popup.disconnect }}\r\n\t\t\t</button>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- TEMPLATE: Disconnect Stripe (on Settings page) -->\r\n\t<script type="text/template" id="forminator-disconnect-stripe-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10">\r\n\t\t\t<p class="sui-description" style="text-align: center;">{{ content }}</p>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\r\n\t\t\t<button type="submit" class="disconnect_stripe sui-button sui-button-ghost sui-button-red popup-confirmation-confirm" data-nonce="{{ nonce }}" data-action="disconnect_stripe">\r\n\t\t\t\t<i class="sui-icon-refresh" aria-hidden="true"></i>\r\n\t\t\t\t{{ Forminator.l10n.popup.disconnect }}\r\n\t\t\t</button>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n    <script type="text/template" id="forminator-login-popup-tpl">\r\n\r\n        <div class="wpmudev-row">\r\n\r\n            <div class="wpmudev-col col-12 col-sm-6">\r\n\r\n                <a class="wpmudev-popup--logreg" href="{{ loginUrl }}">\r\n\r\n                    <div class="wpmudev-logreg--header">\r\n\r\n                        <span class="wpdui-icon wpdui-icon-key"></span>\r\n\r\n                        <h3 class="wpmudev-logreg--title">{{ Forminator.l10n.login.login_label }}</h3>\r\n\r\n                    </div>\r\n\r\n                    <div class="wpmudev-logreg--section">\r\n\r\n                        <p class="wpmudev-logreg--description">{{ Forminator.l10n.login.login_description }}</p>\r\n\r\n                        <div class="wpmudev-logreg--image">\r\n                            <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"\r\n                                 width="110" height="140" viewBox="0 0 110 140" preserveAspectRatio="none"\r\n                                 class="wpmudev-svg-login">\r\n                                <defs>\r\n                                    <path id="b" d="M0 40h100v94H0z"/>\r\n                                    <filter id="a" width="116%" height="117%" x="-8%" y="-7.4%"\r\n                                            filterUnits="objectBoundingBox">\r\n                                        <feOffset dy="1" in="SourceAlpha" result="shadowOffsetOuter1"/>\r\n                                        <feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1"\r\n                                                        stdDeviation="2.5"/>\r\n                                        <feColorMatrix in="shadowBlurOuter1"\r\n                                                       values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>\r\n                                    </filter>\r\n                                    <path id="c" d="M10 112h6v6h-6z"/>\r\n                                    <path id="d" d="M10 90h80v15H10z"/>\r\n                                    <path id="e" d="M10 60h80v15H10z"/>\r\n                                </defs>\r\n                                <g fill="none" fill-rule="evenodd" transform="translate(5)">\r\n                                    <use fill="#000" filter="url(#a)" xlink:href="#b"/>\r\n                                    <use fill="#FFF" xlink:href="#b"/>\r\n                                    <rect width="22" height="12" x="68" y="112" fill="#0472AC" rx="3"/>\r\n                                    <path fill="#808285" d="M19 114h26v2H19z"/>\r\n                                    <use fill="#FBFBFB" xlink:href="#c"/>\r\n                                    <path stroke="#E1E1E1" d="M10.5 112.5h5v5h-5z"/>\r\n                                    <use fill="#FBFBFB" xlink:href="#d"/>\r\n                                    <path stroke="#E1E1E1" d="M10.5 90.5h79v14h-79z"/>\r\n                                    <path fill="#808285" d="M10 85h26v2H10z"/>\r\n                                    <use fill="#FBFBFB" xlink:href="#e"/>\r\n                                    <path stroke="#E1E1E1" d="M10.5 60.5h79v14h-79z"/>\r\n                                    <path fill="#808285" d="M10 55h50v2H10z"/>\r\n                                    <circle cx="50" cy="15" r="15" fill="#0272AC"/>\r\n                                </g>\r\n                            </svg>\r\n                        </div>\r\n\r\n                    </div>\r\n\r\n                </a>\r\n\r\n            </div>\r\n\r\n            <div class="wpmudev-col col-12 col-sm-6">\r\n\r\n                <a class="wpmudev-popup--logreg" href="{{ registerUrl }}">\r\n\r\n                    <div class="wpmudev-logreg--header">\r\n\r\n                        <span class="wpdui-icon wpdui-icon-profile-female"></span>\r\n\r\n                        <h3 class="wpmudev-logreg--title">{{ Forminator.l10n.login.registration_label }}</h3>\r\n\r\n                    </div>\r\n\r\n                    <div class="wpmudev-logreg--section">\r\n\r\n                        <p class="wpmudev-logreg--description">{{ Forminator.l10n.login.registration_description }}</p>\r\n\r\n                        <div class="wpmudev-logreg--image">\r\n                            <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"\r\n                                 width="183" height="97" viewBox="0 0 183 97" preserveAspectRatio="none"\r\n                                 class="wpmudev-svg-registration">\r\n                                <defs>\r\n                                    <path id="a" d="M0 58h183v15H0z"/>\r\n                                    <path id="b" d="M0 23h183v15H0z"/>\r\n                                </defs>\r\n                                <g fill="none" fill-rule="evenodd">\r\n                                    <rect width="50" height="14" y="83" fill="#353535" rx="3"/>\r\n                                    <path fill="#FBFBFB" stroke="#E1E1E1" d="M.5 58.5h182v14H.5z"/>\r\n                                    <path fill="#808285" d="M0 51h40v2H0z"/>\r\n                                    <path fill="#FBFBFB" stroke="#E1E1E1" d="M.5 23.5h182v14H.5z"/>\r\n                                    <path fill="#808285" d="M0 16h40v2H0z"/>\r\n                                    <path fill="#353535" d="M0 0h120v6H0z"/>\r\n                                </g>\r\n                            </svg>\r\n                        </div>\r\n\r\n                    </div>\r\n\r\n                </a>\r\n\r\n            </div>\r\n\r\n        </div>\r\n    </script>\r\n\r\n\t<script type="text/template" id="forminator-form-popup-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close">\r\n\t\t\t\t<span class="sui-icon-close" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ Forminator.l10n.form.form_template_title }}</h3>\r\n\r\n\t\t\t<p id="forminator-popup__description" class="sui-description">{{ Forminator.l10n.form.form_template_description }}</p>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-selectors sui-box-selectors-col-2">\r\n\r\n\t\t\t<ul>\r\n\r\n\t\t\t\t{[ _.each(templates, function(template){ ]}\r\n\r\n\t\t\t\t\t{[ if( template.options.id !== \'leads\' ) { ]}\r\n\r\n\t\t\t\t\t\t<li>\r\n\r\n\t\t\t\t\t\t\t<label for="forminator-new-quiz--{{ template.options.id }}" class="sui-box-selector">\r\n\r\n\t\t\t\t\t\t\t\t<input\r\n\t\t\t\t\t\t\t\t\t\ttype="radio"\r\n\t\t\t\t\t\t\t\t\t\tname="forminator-form-template"\r\n\t\t\t\t\t\t\t\t\t\tid="forminator-new-quiz--{{ template.options.id }}"\r\n\t\t\t\t\t\t\t\t\t\tclass="forminator-new-form-type"\r\n\t\t\t\t\t\t\t\t\t\tvalue="{{ template.options.id }}"\r\n\t\t\t\t\t\t\t\t\t\t{[ if( template.options.id === \'blank\' ) { ]}\r\n\t\t\t\t\t\t\t\t\t\tchecked="checked"\r\n\t\t\t\t\t\t\t\t\t\t{[ } ]}\r\n\t\t\t\t\t\t\t\t/>\r\n\r\n\t\t\t\t\t\t\t\t<span>\r\n\t\t\t\t\t\t\t\t\t<i class="sui-icon-{{template.options.icon}}" aria-hidden="true"></i>\r\n\t\t\t\t\t\t\t\t\t{{ template.options.name }}\r\n\t\t\t\t\t\t\t\t</span>\r\n\r\n\t\t\t\t\t\t\t</label>\r\n\r\n\t\t\t\t\t\t</li>\r\n\r\n\t\t\t\t\t{[ } ]}\r\n\r\n\t\t\t\t{[ }); ]}\r\n\r\n\t\t\t</ul>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten">\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button select-quiz-template">\r\n\t\t\t\t\t<span class="sui-loading-text">{{ Forminator.l10n.quiz.continue_button }}</span>\r\n\t\t\t\t\t<i class="sui-icon-load sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n    <script type="text/template" id="forminator-new-form-popup-tpl">\r\n\r\n        <div class="wpmudev-box--congrats">\r\n\r\n            <div class="wpmudev-congrats--image"></div>\r\n\r\n            <div class="wpmudev-congrats--message">\r\n\r\n                <p><strong>{{ title }}</strong> {{ Forminator.l10n.popup.is_ready }}<br/>\r\n\t\t\t\t\t{{ Forminator.l10n.popup.new_form_desc }}</p>\r\n\r\n            </div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n    <script type="text/template" id="forminator-confirmation-popup-tpl">\r\n\r\n\t    <div class="sui-box-body sui-content-center">\r\n\t\t    <p>{{ confirmation_message }}</p>\r\n\t    </div>\r\n\r\n        <div class="sui-box-footer sui-flatten sui-content-center">\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost popup-confirmation-cancel">{{ Forminator.l10n.popup.cancel }}</button>\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost sui-button-red popup-confirmation-confirm">\r\n\t\t\t\t<span class="sui-loading-text">{{ Forminator.l10n.popup.delete }}</span>\r\n\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t</button>\r\n        </div>\r\n\r\n    </script>\r\n\r\n\t<script type="text/template" id="forminator-delete-poll-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\t\t\t<span class="sui-description">{{ content }}</span>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer">\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\t\t\t<button type="submit" class="delete-poll-submission sui-button sui-button-ghost sui-button-red popup-confirmation-confirm" data-nonce="{{ nonce }}" data-id="{{ id }}" data-action="delete_poll_submissions">\r\n\t\t\t\t{{ Forminator.l10n.popup.delete }}\r\n\t\t\t</button>\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="forminator-approve-user-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\t\t\t<span class="sui-description">{{ content }}</span>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer">\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\t\t\t<form method="post" class="form-approve-user">\r\n\t\t\t\t<input type="hidden" name="forminator_action" value="approve_user">\r\n\t\t\t\t<input type="hidden" name="id" value="{{ id }}">\r\n\t\t\t\t<input type="hidden" name="activationKey" value="{{ activationKey }}">\r\n\t\t\t\t<input type="hidden" id="forminatorNonce" name="forminatorNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" id="forminatorEntryNonce" name="forminatorEntryNonce" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" name="_wp_http_referer" value="{{ referrer }}">\r\n\t\t\t\t<button type="submit" class="sui-button approve-user popup-confirmation-confirm">\r\n\t\t\t\t\t{{ Forminator.l10n.popup.approve_user }}\r\n\t\t\t\t</button>\r\n\t\t\t</form>\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="forminator-delete-unconfirmed-user-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\t\t\t<span class="sui-description">{{ content }}</span>\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer">\r\n\t\t\t<button type="button" class="sui-button sui-button-ghost forminator-popup-cancel" data-a11y-dialog-hide>{{ Forminator.l10n.popup.cancel }}</button>\r\n\t\t\t<form method="post" class="form-delete-unconfirmed-user">\r\n\t\t\t\t<input type="hidden" name="forminatorAction" value="delete-unconfirmed-user">\r\n\t\t\t\t<input type="hidden" name="formId" value="{{ formId }}">\r\n\t\t\t\t<input type="hidden" name="entryId" value="{{ entryId }}">\r\n\t\t\t\t<input type="hidden" name="activationKey" value="{{ activationKey }}">\r\n\t\t\t\t<input type="hidden" id="forminatorNonceDeleteUnconfirmedUser" name="forminatorNonceDeleteUnconfirmedUser" value="{{ nonce }}">\r\n\t\t\t\t<input type="hidden" name="_wp_http_referer" value="{{ referrer }}">\r\n\t\t\t\t<button type="submit" class="sui-button sui-button-ghost sui-button-red delete-unconfirmed-user popup-confirmation-confirm">\r\n\t\t\t\t\t<i class="sui-icon-trash" aria-hidden="true"></i>\r\n\t\t\t\t\t{{ Forminator.l10n.popup.delete }}\r\n\t\t\t\t</button>\r\n\t\t\t</form>\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="forminator-addons-action-popup-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--0">\r\n\r\n\t\t\t{[ if( forms.length <= 0 ) { ]}\r\n\r\n\t\t\t\t<p id="forminator-popup__description" class="sui-description" style="text-align: center;">{{ Forminator.l10n.popup.deactivateContent }}</p>\r\n\r\n\t\t\t{[ } else { ]}\r\n\r\n\t\t\t\t<p id="forminator-popup__description" class="sui-description" style="text-align: center;">{{ content }}</p>\r\n\r\n\t\t\t\t<div class="form-list">\r\n\r\n\t\t\t\t\t<h4 class="sui-table-title" style="margin: 0 0 5px;">{{ Forminator.l10n.popup.forms }}</h4>\r\n\r\n\t\t\t\t\t<table class="sui-table" style="margin: 0;">\r\n\t\t\t\t\t\t<tbody>\r\n\t\t\t\t\t\t{[ _.each( forms, function( value, key ){ ]}\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<td class="sui-table-item-title">\r\n\t\t\t\t\t\t\t\t\t<span class="sui-icon-clipboard-notes" aria-hidden="true"></span>\r\n\t\t\t\t\t\t\t\t\t{{ value }}\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t\t<td width="73" style="text-align: right;">\r\n\t\t\t\t\t\t\t\t\t<a href="{{ forminatorData.formEditUrl + \'&id=\' + key }}" title="{{ value }}" class="sui-button-icon">\r\n\t\t\t\t\t\t\t\t\t\t<span class="sui-icon-pencil" aria-hidden="true"></span>\r\n\t\t\t\t\t\t\t\t\t</a>\r\n\t\t\t\t\t\t\t\t</td>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t{[ }) ]}\r\n\t\t\t\t\t\t</tbody>\r\n\t\t\t\t\t</table>\r\n\r\n\t\t\t\t</div>\r\n\r\n\t\t\t{[ } ]}\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-separated">\r\n\r\n\t\t\t<button type="button" class="sui-button forminator-popup-close" data-a11y-dialog-hide>\r\n\t\t\t\t{{ Forminator.l10n.popup.cancel }}\r\n\t\t\t</button>\r\n\r\n\t\t\t{[ if( forms.length <= 0 ) { ]}\r\n\t\t\t\t<button class="sui-button addons-actions" data-addon="{{ id }}" data-nonce="{{ nonce }}" data-popup="true" data-is_network="{{ is_network }}" data-action="addons-deactivate">\r\n\t\t\t\t\t{{ Forminator.l10n.popup.deactivate }}\r\n\t\t\t\t</button>\r\n\t\t\t{[ } else { ]}\r\n\t\t\t\t<button class="sui-button sui-button-ghost sui-button-red addons-actions" data-addon="{{ id }}" data-nonce="{{ nonce }}" data-popup="true" data-is_network="{{ is_network }}" data-action="addons-deactivate">\r\n\t\t\t\t\t{{ Forminator.l10n.popup.deactivateAnyway }}\r\n\t\t\t\t</button>\r\n\t\t\t{[ } ]}\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="forminator-apply-appearance-preset-tpl">\r\n\r\n\t\t<div class="sui-box-body">\r\n\t\t\t<span class="sui-description" style="text-align: center; margin: -15px 0 30px;">{{ description }}</span>\r\n\r\n\t\t\t<div class="sui-form-field" style="margin-bottom: 10px;">\r\n\t\t\t\t{{ selectbox }}\r\n\t\t\t</div>\r\n\r\n\t\t\t<div class="sui-notice" style="margin-top: 10px;">\r\n\t\t\t\t<div class="sui-notice-content">\r\n\t\t\t\t\t<div class="sui-notice-message">\r\n\t\t\t\t\t\t<span class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></span>\r\n\t\t\t\t\t\t<p>{{ notice }}</p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\t\t\t<button id="forminator-apply-preset" class="sui-button sui-button-blue">\r\n\t\t\t\t<span class="sui-button-text-default">\r\n\t\t\t\t\t<i class="sui-icon-check" aria-hidden="true"></i> {{ button }}\r\n\t\t\t\t</span>\r\n\t\t\t\t<span class="sui-button-text-onload">\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t</span>\r\n\t\t\t</button>\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="forminator-create-appearance-preset-tpl">\r\n\r\n\t\t<div class="sui-box-body sui-content-center">\r\n\t\t\t<span class="sui-description" style="margin: -15px 0 30px">{{ content }}</span>\r\n\r\n\t\t\t<div class="sui-form-field">\r\n\t\t\t\t<label for="forminator-preset-name" class="sui-label">{{ nameLabel }}</label>\r\n\t\t\t\t<input type="text"\r\n\t\t\t\t\t   id="forminator-preset-name"\r\n\t\t\t\t\t   class="sui-form-control fui-required"\r\n\t\t\t\t\t   placeholder="{{ namePlaceholder }}">\r\n\t\t\t</div>\r\n\r\n\t\t\t<div class="sui-form-field">\r\n\t\t\t\t<label class="sui-label">{{ formLabel }}</label>\r\n\t\t\t\t{{ forminatorData.forms_select }}\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center">\r\n\t\t\t<button id="forminator-create-preset" class="sui-button sui-button-blue" disabled="disabled">\r\n\t\t\t\t<span class="sui-button-text-default">\r\n\t\t\t\t\t<i class="sui-icon-plus" aria-hidden="true"></i> {{ title }}\r\n\t\t\t\t</span>\r\n\t\t\t\t<span class="sui-button-text-onload">\r\n\t\t\t\t\t<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>\r\n\t\t\t\t\t{{ loadingText }}\r\n\t\t\t\t</span>\r\n\t\t\t</button>\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n</div>\r\n';});
     4483
     4484(function ($) {
     4485    formintorjs.define('admin/popup/templates',[
     4486        'text!tpl/dashboard.html',
     4487    ], function( popupTpl ) {
     4488        return Backbone.View.extend({
     4489            className: 'forminator-popup-create--cform',
     4490
     4491            step: '1',
     4492
     4493            template: 'blank',
     4494
     4495            events: {
     4496                "click .select-quiz-template": "selectTemplate",
     4497                "click .forminator-popup-close": "close",
     4498                "change .forminator-new-form-type": "clickTemplate",
     4499                "click #forminator-build-your-form": "handleMouseClick",
     4500                "focus #forminator-form-name": "resetNameSetup",
     4501                "keyup": "handleKeyClick"
     4502            },
     4503
     4504            popupTpl: Forminator.Utils.template( $( popupTpl ).find( '#forminator-form-popup-tpl' ).html()),
     4505
     4506            newFormTpl: Forminator.Utils.template( $( popupTpl ).find( '#forminator-new-form-tpl' ).html()),
     4507
     4508            newFormContent: Forminator.Utils.template( $( popupTpl ).find( '#forminator-new-form-content-tpl' ).html() ),
     4509
     4510            render: function() {
     4511                var $popup = jQuery( '#forminator-popup');
     4512
     4513                if( this.step === '1' ) {
     4514                    this.$el.html( this.popupTpl({
     4515                        templates: Forminator.Data.modules.custom_form.templates
     4516                    }) );
     4517
     4518                    this.$el.find( '.select-quiz-template' ).prop( "disabled", false );
     4519
     4520                    $popup.closest( '.sui-modal' ).removeClass( "sui-modal-sm" );
     4521                }
     4522
     4523                if( this.step === '2' ) {
     4524                    // Add name field
     4525                    this.$el.html( this.newFormTpl() );
     4526                    this.$el.find('.sui-box-body').html( this.newFormContent() );
     4527                    if( this.template === 'registration' ) {
     4528                        this.$el.find('#forminator-template-register-notice').show();
     4529                        this.$el.find('#forminator-form-name').val( Forminator.l10n.popup.registration_name );
     4530                    }
     4531                    if( this.template === 'login' ) {
     4532                        this.$el.find('#forminator-template-login-notice').show();
     4533                        this.$el.find('#forminator-form-name').val( Forminator.l10n.popup.login_name );
     4534                    }
     4535
     4536                    $popup.closest( '.sui-modal' ).addClass( 'sui-modal-sm' );
     4537                }
     4538            },
     4539
     4540            close: function( e ) {
     4541                e.preventDefault();
     4542
     4543                Forminator.Popup.close();
     4544            },
     4545
     4546            clickTemplate: function( e ) {
     4547                this.$el.find( '.select-quiz-template' ).prop( "disabled", false );
     4548            },
     4549
     4550            selectTemplate: function( e ) {
     4551                e.preventDefault();
     4552
     4553                var template = this.$el.find( 'input[name=forminator-form-template]:checked' ).val();
     4554
     4555                this.template = template;
     4556
     4557                this.step = '2';
     4558                this.render();
     4559            },
     4560
     4561            handleMouseClick: function( e ) {
     4562                this.createQuiz( e );
     4563            },
     4564
     4565            handleKeyClick: function( e ) {
     4566                e.preventDefault();
     4567
     4568                // If enter create form
     4569                if( e.which === 13 ) {
     4570                    this.createQuiz( e );
     4571                }
     4572            },
     4573
     4574            resetNameSetup: function( e ) {
     4575                var $error = $( e.target ).next( '.sui-error-message' );
     4576
     4577                if ( $error.is( ':visible' ) ) {
     4578                    $error.hide();
     4579                    this.$el.find( '#forminator-build-your-form' ).removeClass( 'sui-button-onload' );
     4580                }
     4581            },
     4582
     4583            createQuiz: function( e ) {
     4584                var $form_name = $( e.target ).addClass('sui-button-onload').closest( '.sui-box' ).find( '#forminator-form-name' );
     4585
     4586                if( $form_name.val().trim() === "" ) {
     4587                    $( e.target ).closest( '.sui-box' ).find( '.sui-error-message' ).show();
     4588                }  else {
     4589                    var url = Forminator.Data.modules.custom_form.new_form_url
     4590
     4591                    $( e.target ).closest( '.sui-box' ).find( '.sui-error-message' ).hide();
     4592
     4593                    form_url = url + '&name=' + $form_name.val();
     4594
     4595                    form_url = form_url + '&template=' + this.template;
     4596
     4597                    window.location.href = form_url;
     4598                }
     4599            }
     4600        });
     4601    });
     4602})(jQuery);
     4603
     4604(function ($) {
     4605    formintorjs.define('admin/popup/login',[
     4606        'text!tpl/dashboard.html',
     4607    ], function( popupTpl ) {
     4608        return Backbone.View.extend({
     4609            className: 'wpmudev-section--popup',
     4610
     4611            popupTpl: Forminator.Utils.template( $( popupTpl ).find( '#forminator-login-popup-tpl' ).html()),
     4612
     4613            render: function() {
     4614                this.$el.html( this.popupTpl({
     4615                    loginUrl: Forminator.Data.modules.login.login_url,
     4616                    registerUrl: Forminator.Data.modules.login.register_url
     4617                }));
     4618            },
     4619        });
     4620    });
     4621})(jQuery);
     4622
     4623(function ($) {
     4624    formintorjs.define('admin/popup/quizzes',[
     4625        'text!tpl/dashboard.html',
     4626    ], function( popupTpl ) {
     4627        return Backbone.View.extend({
     4628            className: 'forminator-popup-create--quiz',
     4629
     4630            step: 1,
     4631            pagination: 0,
     4632
     4633            type: 'knowledge',
     4634
     4635            events: {
     4636                "click .select-quiz-template": "selectTemplate",
     4637                "click .select-quiz-pagination": "selectPagination",
     4638                "click .forminator-popup-back": "goBack",
     4639                "click .forminator-popup-close": "close",
     4640                "change .forminator-new-quiz-type": "clickTemplate",
     4641                "click #forminator-build-your-form": "handleMouseClick",
     4642                "click #forminator-new-quiz-leads": "handleToggle",
     4643                "focus #forminator-form-name": "resetNameSetup",
     4644                "keyup": "handleKeyClick"
     4645            },
     4646
     4647            popupTpl: Forminator.Utils.template( $( popupTpl ).find( '#forminator-quizzes-popup-tpl' ).html()),
     4648
     4649            newFormTpl: Forminator.Utils.template( $( popupTpl ).find( '#forminator-new-quiz-tpl' ).html()),
     4650
     4651            paginationTpl: Forminator.Utils.template( $( popupTpl ).find( '#forminator-new-quiz-pagination-tpl' ).html()),
     4652
     4653            newFormContent: Forminator.Utils.template( $( popupTpl ).find( '#forminator-new-quiz-content-tpl' ).html() ),
     4654
     4655            render: function() {
     4656                var $popup = jQuery( '#forminator-popup');
     4657                $popup.removeClass( "sui-dialog-sm forminator-create-quiz-second-step forminator-create-quiz-pagination-step" );
     4658
     4659                if( this.step === 1 ) {
     4660                    this.$el.html( this.popupTpl() );
     4661
     4662                    if ( this.name ) {
     4663                        this.$el.find( '#forminator-form-name' ).val( this.name );
     4664                        this.$el.find( '#forminator-new-quiz--' + this.type ).prop('checked',true);
     4665                    }
     4666
     4667                    this.$el.find( '.select-quiz-template' ).prop( "disabled", false );
     4668
     4669                }
     4670
     4671                if( this.step === 2 ) {
     4672                    this.$el.html( this.paginationTpl() );
     4673                    if ( window.isTrue( this.pagination ) ) {
     4674                        this.$el.find( '[name="forminator-quiz-pagination"]' ).eq(1).prop( 'checked', true );
     4675                    } else {
     4676                        this.$el.find( '[name="forminator-quiz-pagination"]' ).eq(0).prop( 'checked', true );
     4677                    }
     4678
     4679                    $popup.addClass( "forminator-create-quiz-pagination-step" );
     4680                }
     4681
     4682                if( this.step === 3 ) {
     4683                    // Add name field
     4684                    this.$el.html( this.newFormTpl() );
     4685                    this.$el.find('.sui-box-body').html( this.newFormContent() );
     4686
     4687                    $popup.addClass( "sui-dialog-sm forminator-create-quiz-second-step" );
     4688                }
     4689            },
     4690
     4691            close: function( e ) {
     4692                e.preventDefault();
     4693
     4694                Forminator.Popup.close();
     4695            },
     4696
     4697            clickTemplate: function( e ) {
     4698                this.$el.find( '.select-quiz-template' ).prop( "disabled", false );
     4699            },
     4700
     4701            selectTemplate: function( e ) {
     4702                e.preventDefault();
     4703
     4704                var type = this.$el.find( 'input[name=forminator-new-quiz]:checked' ).val();
     4705                var form_name = this.$el.find( '#forminator-form-name' ).val();
     4706
     4707                if( form_name.trim() === "" ) {
     4708                    $( e.target ).closest( '.sui-box' ).find( '.sui-error-message' ).show();
     4709                } else {
     4710                    this.type = type;
     4711                    this.name = form_name;
     4712
     4713                    this.step = 2;
     4714                    this.render();
     4715                }
     4716            },
     4717
     4718            goBack: function( e ) {
     4719                e.preventDefault();
     4720
     4721                if ( 2 == this.step ) {
     4722                    this.pagination = this.$el.find( 'input[name="forminator-quiz-pagination"]:checked' ).val();
     4723                }
     4724
     4725                this.step--;
     4726                this.render();
     4727            },
     4728
     4729            selectPagination: function( e ) {
     4730                e.preventDefault();
     4731
     4732                var pagination = this.$el.find( 'input[name="forminator-quiz-pagination"]:checked' ).val();
     4733
     4734                this.pagination = pagination;
     4735
     4736                this.step = 3;
     4737                this.render();
     4738            },
     4739
     4740            handleMouseClick: function( e ) {
     4741                this.createQuiz( e );
     4742            },
     4743
     4744            handleKeyClick: function( e ) {
     4745                e.preventDefault();
     4746
     4747                // If enter create form
     4748                if( e.which === 13 ) {
     4749                    if( this.step === 1 ) {
     4750                        this.selectTemplate( e );
     4751                    } else {
     4752                        this.createQuiz( e );
     4753                    }
     4754                }
     4755            },
     4756
     4757            handleToggle: function( e ) {
     4758                var leads = $( e.target ).is(':checked');
     4759                var $notice = $( e.target ).closest( '.sui-box' ).find( '#sui-quiz-leads-description' );
     4760
     4761                if ( leads ) {
     4762                    $notice.show();
     4763                } else {
     4764                    $notice.hide();
     4765                }
     4766            },
     4767
     4768            resetNameSetup: function( e ) {
     4769                var $error = $( e.target ).next( '.sui-error-message' );
     4770
     4771                if ( $error.is( ':visible' ) ) {
     4772                    $error.hide();
     4773                    this.$el.find( '#forminator-build-your-form' ).removeClass( 'sui-button-onload' );
     4774                }
     4775            },
     4776
     4777            createQuiz: function( e ) {
     4778                var leads = $( e.target ).addClass('sui-button-onload').closest( '.sui-box' ).find( '#forminator-new-quiz-leads' ).is(':checked');
     4779
     4780                var url = Forminator.Data.modules.quizzes.knowledge_url;
     4781
     4782                if( this.type === "nowrong" ) {
     4783                    url = Forminator.Data.modules.quizzes.nowrong_url;
     4784                }
     4785
     4786                form_url = url + '&name=' + this.name;
     4787
     4788                if ( window.isTrue( this.pagination ) ) {
     4789                    form_url = form_url + '&pagination=true';
     4790                }
     4791
     4792                if ( leads ) {
     4793                    form_url = form_url + '&leads=true';
     4794                }
     4795
     4796                window.location.href = form_url;
     4797            }
     4798        });
     4799    });
     4800})(jQuery);
     4801
     4802(function ($) {
     4803    formintorjs.define('admin/popup/schedule',[
     4804        'text!tpl/dashboard.html',
     4805    ], function (popupTpl) {
     4806        return Backbone.View.extend({
     4807
     4808            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-exports-schedule-popup-tpl').html()),
     4809
     4810            events: {
     4811                'change select[name="interval"]': "on_change_interval",
     4812                // 'change #forminator-enable-scheduled-exports': 'on_change_enabled',
     4813                'click .sui-toggle-label': 'click_label',
     4814                'click .tab-labels .sui-tab-item': 'click_tab_label',
     4815                'click .wpmudev-action-done': 'submit_schedule',
     4816            },
     4817
     4818            render: function () {
     4819
     4820                this.$el.html(this.popupTpl({}));
     4821
     4822                // Delegate SUI events
     4823                Forminator.Utils.sui_delegate_events();
     4824
     4825                var data = forminatorl10n.exporter;
     4826
     4827                this.$el.find('input[name="if_new"]').prop('checked', data.if_new);
     4828
     4829                this.set_enabled(data.enabled);
     4830
     4831                this.$el.find('select[name="interval"]').change();
     4832                if (data.email === null) {
     4833                    return;
     4834                }
     4835                this.$el.find('select[name="interval"]').val(data.interval);
     4836                this.$el.find('select[name="day"]').val(data.day);
     4837                this.$el.find('select[name="month_day"]').val( (data.month_day ? data.month_day : 1) );
     4838                this.$el.find('select[name="hour"]').val(data.hour);
     4839
     4840                if(data.interval === 'weekly') {
     4841                    this.$el.find('select[name="day"]').closest('.sui-form-field').show();
     4842                } else if(data.interval === 'monthly') {
     4843                    this.$el.find('select[name="month_day"]').closest('.sui-form-field').show();
     4844                }
     4845
     4846                this.load_select();
     4847            },
     4848
     4849            set_enabled: function(enabled) {
     4850                if (enabled) {
     4851                    this.$el.find('input[name="enabled"][value="true"]').prop('checked', true);
     4852                    this.$el.find('input[name="enabled"][value="false"]').prop('checked', false);
     4853
     4854
     4855                    this.$el.find('.tab-label-disable').removeClass('active');
     4856                    this.$el.find('.tab-label-enable').addClass('active');
     4857
     4858                    this.$el.find('.schedule-enabled').show();
     4859                    this.$el.find('input[name="email"]').prop('required', true);
     4860                } else {
     4861                    this.$el.find('input[name="enabled"][value="false"]').prop('checked', true);
     4862                    this.$el.find('input[name="enabled"][value="true"]').prop('checked', false);
     4863
     4864                    this.$el.find('.tab-label-disable').addClass('active');
     4865                    this.$el.find('.tab-label-enable').removeClass('active');
     4866
     4867                    this.$el.find('.schedule-enabled').hide();
     4868                }
     4869
     4870            },
     4871
     4872            load_select: function() {
     4873                var data = forminatorl10n.exporter,
     4874                    options = {
     4875                        tags: true,
     4876                        tokenSeparators: [ ',', ' ' ],
     4877                        language: {
     4878                            searching: function() {
     4879                                return data.searching;
     4880                            },
     4881                            noResults: function() {
     4882                                return data.noResults;
     4883                            },
     4884                        },
     4885                        ajax: {
     4886                            url: forminatorData.ajaxUrl,
     4887                            type: 'POST',
     4888                            delay: 350,
     4889                            data: function( params ) {
     4890                                return {
     4891                                    action: 'forminator_builder_search_emails',
     4892                                    _wpnonce: forminatorData.searchNonce,
     4893                                    q: params.term,
     4894                                    permission: 'forminator-entries',
     4895                                };
     4896                            },
     4897                            processResults: function( data ) {
     4898                                return {
     4899                                    results: data.data,
     4900                                };
     4901                            },
     4902                            cache: true,
     4903                        },
     4904                        createTag: function( params ) {
     4905                            const term = params.term.trim();
     4906                            if ( ! Forminator.Utils.is_email_wp( term ) ) {
     4907                                return null;
     4908                            }
     4909                            return {
     4910                                id: term,
     4911                                text: term,
     4912                            };
     4913                        },
     4914                        insertTag: function( data, tag ) {
     4915                            // Insert the tag at the end of the results
     4916                            data.push( tag );
     4917                        },
     4918
     4919                    };
     4920
     4921                Forminator.Utils.forminator_select2_tags( this.$el, options );
     4922            },
     4923
     4924            on_change_interval: function(e) {
     4925                //hide column
     4926                this.$el.find('select[name="day"]').closest('.sui-form-field').hide();
     4927                this.$el.find('select[name="month_day"]').closest('.sui-form-field').hide();
     4928                if(e.target.value === 'weekly') {
     4929                    this.$el.find('select[name="month-day"]').closest('.sui-form-field').hide();
     4930                    this.$el.find('select[name="day"]').closest('.sui-form-field').show();
     4931                } else if(e.target.value === 'monthly') {
     4932                    this.$el.find('select[name="month_day"]').closest('.sui-form-field').show();
     4933                    this.$el.find('select[name="day"]').closest('.sui-form-field').hide();
     4934                }
     4935
     4936            },
     4937
     4938            click_label: function(e){
     4939                e.preventDefault();
     4940
     4941                // Simulate label click
     4942                this.$el.closest('.sui-form-field').find( '.sui-toggle input' ).click();
     4943            },
     4944
     4945            click_tab_label: function (e) {
     4946                var $target = $(e.target);
     4947
     4948                if ($target.closest('.sui-tab-item').hasClass('tab-label-disable')) {
     4949                    this.set_enabled(false);
     4950                } else if ($target.closest('.sui-tab-item').hasClass('tab-label-enable')) {
     4951                    this.load_select();
     4952                    this.set_enabled(true);
     4953                }
     4954            },
     4955
     4956            submit_schedule: function (e) {
     4957                this.$el.find('form.schedule-action').trigger('submit');
     4958            },
     4959
     4960        });
     4961    });
     4962})(jQuery);
     4963
     4964(function ($) {
     4965    formintorjs.define('admin/popup/new-form',[
     4966        'text!tpl/dashboard.html',
     4967    ], function( popupTpl ) {
     4968        return Backbone.View.extend({
     4969            className: 'wpmudev-section--popup',
     4970
     4971            popupTpl: Forminator.Utils.template( $( popupTpl ).find( '#forminator-new-form-popup-tpl' ).html()),
     4972
     4973            initialize: function ( options ) {
     4974                this.title = options.title;
     4975                this.title = Forminator.Utils.sanitize_uri_string( this.title );
     4976            },
     4977
     4978            render: function() {
     4979                this.$el.html( this.popupTpl({
     4980                    title: this.title
     4981                }));
     4982            },
     4983        });
     4984    });
     4985})(jQuery);
     4986
     4987( function( $ ) {
     4988    formintorjs.define('admin/popup/polls',[
     4989        'text!tpl/dashboard.html',
     4990    ], function( popupTpl ) {
     4991
     4992        return Backbone.View.extend({
     4993
     4994            className: 'wpmudev-popup-templates',
     4995
     4996            newFormTpl: Forminator.Utils.template( $( popupTpl ).find( '#forminator-new-form-tpl' ).html()),
     4997            newPollContent: Forminator.Utils.template( $( popupTpl ).find( '#forminator-new-poll-content-tpl' ).html() ),
     4998
     4999            events: {
     5000                'click #forminator-build-your-form': 'handleMouseClick',
     5001                "focus #forminator-form-name": "resetNameSetup",
     5002                'keyup': 'handleKeyClick'
     5003            },
     5004
     5005            initialize: function( options ) {
     5006                this.options = options;
     5007            },
     5008
     5009            render: function() {
     5010                this.$el.html( this.newFormTpl() );
     5011                this.$el.find('.sui-box-body').html( this.newPollContent() );
     5012            },
     5013
     5014            handleMouseClick: function( e ) {
     5015                this.create_poll( e );
     5016            },
     5017
     5018            handleKeyClick: function( e ) {
     5019                e.preventDefault();
     5020
     5021                // If enter create form
     5022                if( e.which === 13 ) {
     5023                    this.create_poll( e );
     5024                }
     5025            },
     5026
     5027            resetNameSetup: function( e ) {
     5028                var $error = $( e.target ).next( '.sui-error-message' );
     5029
     5030                if ( $error.is( ':visible' ) ) {
     5031                    $error.hide();
     5032                    this.$el.find( '#forminator-build-your-form' ).removeClass( 'sui-button-onload' );
     5033                }
     5034            },
     5035
     5036            create_poll: function( e ) {
     5037                e.preventDefault();
     5038
     5039                var $form_name = $( e.target ).addClass('sui-button-onload').closest( '.sui-box' ).find( '#forminator-form-name' );
     5040
     5041                if( $form_name.val().trim() === "" ) {
     5042                    $( e.target ).closest( '.sui-box' ).find( '.sui-error-message' ).show();
     5043                }  else {
     5044                    var form_url = Forminator.Data.modules.polls.new_form_url;
     5045
     5046                    $( e.target ).closest( '.sui-box' ).find( '.sui-error-message' ).hide();
     5047
     5048                    form_url = form_url + '&name=' + $form_name.val();
     5049                    window.location.href = form_url;
     5050                }
     5051            },
     5052
     5053        });
     5054    });
     5055}( jQuery ) );
     5056
     5057(function ($) {
     5058    formintorjs.define('admin/popup/ajax',[
     5059        'text!tpl/dashboard.html',
     5060    ], function( popupTpl ) {
     5061        return Backbone.View.extend({
     5062            className: 'sui-box-body',
     5063
     5064            events: {
     5065                "click .wpmudev-action-done": "save",
     5066                "click .wpmudev-action-ajax-done": "ajax_save",
     5067                "click .wpmudev-action-ajax-cf7-import": "ajax_cf7_import",
     5068                "click .wpmudev-button-clear-exports": "clear_exports",
     5069                // Add poll funcitonality so the custom answer input shows up on preview
     5070                "click .forminator-radio--field": "show_poll_custom_input",
     5071                "click .forminator-popup-close": "close_popup",
     5072                "click .forminator-retry-import": "ajax_cf7_import",
     5073                "change #forminator-choose-import-form": "import_form_action",
     5074                "change .forminator-import-forms": "import_form_action",
     5075            },
     5076
     5077            initialize: function( options ) {
     5078                options            = _.extend({
     5079                    action       : '',
     5080                    nonce        : '',
     5081                    data         : '',
     5082                    id           : '',
     5083                    enable_loader: true
     5084                }, options);
     5085
     5086                this.action        = options.action;
     5087                this.nonce         = options.nonce;
     5088                this.data          = options.data;
     5089                this.id            = options.id;
     5090                this.enable_loader = options.enable_loader;
     5091
     5092                return this.render();
     5093            },
     5094
     5095            render: function() {
     5096                var self = this,
     5097                    tpl = false,
     5098                    data = {}
     5099                ;
     5100
     5101                data.action = 'forminator_load_' + this.action + '_popup';
     5102                data._ajax_nonce = this.nonce;
     5103                data.data = this.data;
     5104
     5105                if( this.id ) {
     5106                    data.id = this.id;
     5107                }
     5108
     5109                if (this.enable_loader) {
     5110                    var div_preloader = '';
     5111                    if ('sui-box-body' !== this.className) {
     5112                        div_preloader += '<div class="sui-box-body">';
     5113                    }
     5114                    div_preloader +=
     5115                        '<p class="fui-loading-dialog" aria-label="Loading content">' +
     5116                            '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' +
     5117                        '</p>'
     5118                    ;
     5119                    if ('sui-box-body' !== this.className) {
     5120                        div_preloader += '</div>';
     5121                    }
     5122
     5123                    self.$el.html(div_preloader);
     5124                }
     5125
     5126                // make slightly bigger
     5127
     5128                var ajax = $.post({
     5129                    url: Forminator.Data.ajaxUrl,
     5130                    type: 'post',
     5131                    data: data
     5132                })
     5133                .done(function (result) {
     5134                    if (result && result.success) {
     5135                        // Append & Show content
     5136                        self.$el.html(result.data);
     5137                        self.$el.find('.wpmudev-hidden-popup').show(400);
     5138
     5139                        // Delegate SUI events
     5140                        Forminator.Utils.sui_delegate_events();
     5141
     5142                        // Init Pagination on custom form if exist
     5143                        var custom_form = self.$el.find('.forminator-custom-form');
     5144
     5145                        // Delegate events
     5146                        self.delegateEvents();
     5147                    }
     5148                });
     5149
     5150                //remove the preloader
     5151                ajax.always(function () {
     5152                    self.$el.find(".fui-loading-dialog").remove();
     5153                });
     5154            },
     5155
     5156            save: function ( e ) {
     5157                e.preventDefault();
     5158                var data = {},
     5159                    nonce = $( e.target ).data( "nonce" )
     5160                ;
     5161
     5162                data.action = 'forminator_save_' + this.action + '_popup';
     5163                data._ajax_nonce = nonce;
     5164
     5165                // Retieve fields
     5166                $('.wpmudev-popup-form input, .wpmudev-popup-form select').each( function () {
     5167                    var field = $( this );
     5168                    data[ field.attr('name') ] = field.val();
     5169                });
     5170
     5171                $.ajax({
     5172                    url: Forminator.Data.ajaxUrl,
     5173                    type: "POST",
     5174                    data: data,
     5175                    success: function( result ) {
     5176                        Forminator.Popup.close( false, function() {
     5177                            window.location.reload();
     5178                        });
     5179                    }
     5180                });
     5181            },
     5182            ajax_save: function ( e ) {
     5183                var self = this;
     5184                // display error response if avail
     5185                // redirect to url on response if avail
     5186                e.preventDefault();
     5187                var data = {},
     5188                    nonce = $( e.target ).data( "nonce" )
     5189                ;
     5190
     5191                data.action = 'forminator_save_' + this.action + '_popup';
     5192                data._ajax_nonce = nonce;
     5193
     5194                // Retieve fields
     5195                $('.wpmudev-popup-form input, .wpmudev-popup-form select, .wpmudev-popup-form textarea').each( function () {
     5196                    var field = $( this );
     5197
     5198                    if (
     5199                        'checkbox' !== field[0].type ||
     5200                        ( 'checkbox' === field[0].type && field[0].checked )
     5201                    ) {
     5202                        data[ field.attr('name') ] = field.val();
     5203                    }
     5204                });
     5205
     5206                this.$el.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload");
     5207
     5208                var ajax = $.ajax({
     5209                    url    : Forminator.Data.ajaxUrl,
     5210                    type   : "POST",
     5211                    data   : data,
     5212                    success: function (result) {
     5213                        if (true === result.success) {
     5214                            var redirect = false;
     5215                            if (!_.isUndefined(result.data.url)) {
     5216                                redirect = result.data.url;
     5217                            }
     5218                            Forminator.Popup.close(false, function () {
     5219                                if (redirect) {
     5220                                    location.href = redirect;
     5221                                }
     5222                            });
     5223                        } else {
     5224                            const noticeId = 'wpmudev-ajax-error-placeholder';
     5225                            const noticeMessage = '<p>' + result.data + '</p>';
     5226                            const noticeOption = {
     5227                                type: 'error',
     5228                                autoclose: {
     5229                                    timeout: 8000
     5230                                }
     5231                            };
     5232
     5233                            if (!_.isUndefined(result.data)) {
     5234                                SUI.openNotice( noticeId, noticeMessage, noticeOption );
     5235                            }
     5236                        }
     5237                    }
     5238                });
     5239                ajax.always(function () {
     5240                    self.$el.find(".sui-button:not(.disable-loader)").removeClass("sui-button-onload");
     5241                })
     5242            },
     5243
     5244            clear_exports: function ( e ) {
     5245                e.preventDefault();
     5246                var data = {},
     5247                    self = this,
     5248                    nonce = $( e.target ).data( "nonce" ),
     5249                    form_id = $( e.target ).data( "form-id" )
     5250                ;
     5251
     5252                data.action = 'forminator_clear_' + this.action + '_popup';
     5253                data._ajax_nonce = nonce;
     5254                data.id = form_id;
     5255
     5256                $.ajax({
     5257                    url: Forminator.Data.ajaxUrl,
     5258                    type: "POST",
     5259                    data: data,
     5260                    success: function() {
     5261                        self.render();
     5262                    }
     5263                });
     5264            },
     5265            show_poll_custom_input: function (e) {
     5266                var self = this,
     5267                    $input = this.$el.find('.forminator-input'),
     5268                    checked = e.target.checked,
     5269                    $id = $(e.target).attr('id');
     5270
     5271                $input.hide();
     5272                if (self.$el.find('.forminator-input#' + $id + '-extra').length) {
     5273                    var $extra = self.$el.find('.forminator-input#' + $id + '-extra');
     5274                    if (checked) {
     5275                        $extra.show();
     5276                    } else {
     5277                        $extra.hide();
     5278                    }
     5279                }
     5280            },
     5281            ajax_cf7_import: function ( e ) {
     5282                var self = this,
     5283                    data = self.$el.find('form').serializeArray();
     5284                // display error response if avail
     5285                // redirect to url on response if avail
     5286                e.preventDefault();
     5287
     5288                this.$el.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload");
     5289                this.$el.find('.wpmudev-ajax-error-placeholder').addClass('sui-hidden');
     5290                this.$el.find(".forminator-cf7-imported-fail").addClass("sui-hidden");
     5291
     5292                var ajax = $.ajax({
     5293                    url    : Forminator.Data.ajaxUrl,
     5294                    type   : "POST",
     5295                    data   : data,
     5296                    xhr: function () {
     5297                        var xhr = new window.XMLHttpRequest();
     5298                        xhr.upload.addEventListener("progress", function (evt) {
     5299                            if ( evt.lengthComputable ) {
     5300                                var percentComplete = evt.loaded / evt.total;
     5301                                percentComplete = parseInt(percentComplete * 100);
     5302                                self.$el.find(".forminator-cf7-importing .sui-progress-text").html( percentComplete + '%');
     5303                                self.$el.find(".forminator-cf7-importing .sui-progress-bar span").css( 'width', percentComplete + '%');
     5304                            }
     5305                        }, false);
     5306                        return xhr;
     5307                    },
     5308                    success: function (result) {
     5309                        if (true === result.success) {
     5310                            setTimeout(function(){
     5311                                self.$el.find(".forminator-cf7-importing").addClass("sui-hidden");
     5312                                self.$el.find(".forminator-cf7-imported").removeClass("sui-hidden");
     5313                            }, 1000);
     5314                        } else {
     5315                            if (!_.isUndefined(result.data)) {
     5316                                setTimeout(function(){
     5317                                        self.$el.find(".forminator-cf7-importing").addClass("sui-hidden");
     5318                                        self.$el.find(".forminator-cf7-imported-fail").removeClass("sui-hidden");
     5319                                    }, 1000);
     5320                                self.$el.find('.wpmudev-ajax-error-placeholder').removeClass('sui-hidden').find('p').text(result.data);
     5321                            }
     5322                        }
     5323                    }
     5324                });
     5325                ajax.always(function (e) {
     5326                    self.$el.find(".sui-button:not(.disable-loader)").removeClass("sui-button-onload");
     5327                    self.$el.find(".forminator-cf7-import").addClass("sui-hidden");
     5328                    self.$el.find(".forminator-cf7-importing").removeClass("sui-hidden");
     5329                });
     5330            },
     5331            close_popup: function() {
     5332                Forminator.Popup.close();
     5333            },
     5334
     5335            import_form_action: function(e) {
     5336                e.preventDefault();
     5337                var target = $(e.target),
     5338                    value = target.val(),
     5339                    btn_action = false;
     5340                if( 'specific' === value ) {
     5341                    btn_action = true;
     5342                }
     5343                if( value == null || ( Array.isArray( value ) && value.length < 1 ) ) {
     5344                    btn_action = true;
     5345                }
     5346                this.$el.find('.wpmudev-action-ajax-cf7-import').prop( "disabled", btn_action );
     5347            },
     5348        });
     5349    });
     5350})(jQuery);
     5351
     5352(function ($) {
     5353    formintorjs.define('admin/popup/delete',[
     5354        'text!tpl/dashboard.html',
     5355    ], function (popupTpl) {
     5356        return Backbone.View.extend({
     5357            className: 'wpmudev-section--popup',
     5358
     5359            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-delete-popup-tpl').html()),
     5360            popupPollTpl: Forminator.Utils.template($(popupTpl).find('#forminator-delete-poll-popup-tpl').html()),
     5361
     5362            initialize: function( options ) {
     5363                this.module = options.module;
     5364                this.nonce = options.nonce;
     5365                this.id = options.id;
     5366                this.action = options.action;
     5367                this.referrer = options.referrer;
     5368                this.button = options.button || Forminator.l10n.popup.delete;
     5369                this.content = options.content || Forminator.l10n.popup.cannot_be_reverted ;
     5370            },
     5371
     5372            render: function () {
     5373                if( 'poll' === this.module ) {
     5374                    this.$el.html(this.popupPollTpl({
     5375                        nonce: this.nonce,
     5376                        id: this.id,
     5377                        referrer: this.referrer,
     5378                        content: this.content,
     5379                    }));
     5380                } else {
     5381                    this.$el.html(this.popupTpl({
     5382                        nonce: this.nonce,
     5383                        id: this.id,
     5384                        action: this.action,
     5385                        referrer: this.referrer,
     5386                        button: this.button,
     5387                        content: this.content,
     5388                    }));
     5389                }
     5390            },
     5391        });
     5392    });
     5393})(jQuery);
     5394
     5395(function ($) {
     5396    formintorjs.define('admin/popup/preview',[
     5397        'text!tpl/dashboard.html',
     5398    ], function( popupTpl ) {
     5399        return Backbone.View.extend({
     5400            className: 'sui-box-body',
     5401
     5402            initialize: function( options ) {
     5403                var self = this;
     5404                var args = {
     5405                    action       : '',
     5406                    type         : '',
     5407                    id           : '',
     5408                    preview_data : {},
     5409                    enable_loader: true
     5410                };
     5411                if ( 'forminator_quizzes' === options.type ) {
     5412                    args.has_lead = options.has_lead;
     5413                    args.leads_id  = options.leads_id;
     5414                }
     5415                options            = _.extend( args, options );
     5416
     5417                this.action        = options.action;
     5418                this.type          = options.type;
     5419                this.nonce         = options.nonce;
     5420                this.id            = options.id;
     5421                this.render_id     = 0;
     5422                this.preview_data  = options.preview_data;
     5423                this.enable_loader = options.enable_loader;
     5424
     5425                if ( 'forminator_quizzes' === options.type ) {
     5426                    this.has_lead = options.has_lead;
     5427                    this.leads_id  = options.leads_id;
     5428                }
     5429
     5430                $(document).off('after.load.forminator');
     5431                $(document).on('after.load.forminator', function(e){
     5432                    self.after_load();
     5433                });
     5434
     5435                return this.render();
     5436            },
     5437
     5438            render: function () {
     5439                var self = this,
     5440                    tpl  = false,
     5441                    data = {}
     5442                ;
     5443
     5444                data.action           = this.action;
     5445                data.type             = this.type;
     5446                data.id               = this.id;
     5447                data.render_id        = this.render_id;
     5448                data.nonce               = this.nonce;
     5449                data.is_preview       = 1;
     5450                data.preview_data     = this.preview_data;
     5451                data.last_submit_data = {};
     5452
     5453                if ( 'forminator_quizzes' === this.type ) {
     5454                    data.has_lead  = this.has_lead;
     5455                    data.leads_id  = this.leads_id;
     5456                }
     5457
     5458                if (this.enable_loader) {
     5459                    var div_preloader = '';
     5460                    if ('sui-box-body' !== this.className) {
     5461                        div_preloader += '<div class="sui-box-body">';
     5462                    }
     5463                    div_preloader +=
     5464                        '<div class="fui-loading-dialog">' +
     5465                            '<p style="margin: 0; text-align: center;" aria-hidden="true"><span class="sui-icon-loader sui-md sui-loading"></span></p>' +
     5466                            '<p class="sui-screen-reader-text">Loading content...</p>' +
     5467                        '</div>';
     5468                    ;
     5469                    if ('sui-box-body' !== this.className) {
     5470                        div_preloader += '</div>';
     5471                    }
     5472
     5473                    self.$el.html(div_preloader);
     5474                }
     5475
     5476                var dummyForm = $('<form id="forminator-module-' + this.id + '" data-forminator-render="' + this.render_id+ '" style="display:none"></form>');
     5477                self.$el.append(dummyForm);
     5478
     5479                $(self.$el.find('#forminator-module-' + this.id +'[data-forminator-render="' + this.render_id+ '"]').get(0)).forminatorLoader(data);
     5480
     5481            },
     5482
     5483            after_load: function() {
     5484                var self = this;
     5485                self.$el.find('div[data-form="forminator-module-' + this.id + '"]').remove();
     5486                self.$el.find(".fui-loading-dialog").remove();
     5487            }
     5488        });
     5489    });
     5490})(jQuery);
     5491
     5492(function ($) {
     5493    formintorjs.define('admin/popup/reset-plugin-settings',[
     5494        'text!tpl/dashboard.html',
     5495    ], function (popupTpl) {
     5496        return Backbone.View.extend({
     5497            className: 'wpmudev-section--popup',
     5498
     5499            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-reset-plugin-settings-popup-tpl').html()),
     5500
     5501            events: {
     5502                "click .popup-confirmation-confirm": "confirm_action",
     5503            },
     5504
     5505            initialize: function( options ) {
     5506                this.nonce = options.nonce;
     5507                this.referrer = options.referrer;
     5508                this.content = options.content || Forminator.l10n.popup.cannot_be_reverted ;
     5509            },
     5510
     5511            render: function () {
     5512                this.$el.html(this.popupTpl({
     5513                    nonce: this.nonce,
     5514                    id: this.id,
     5515                    referrer: this.referrer,
     5516                    content: this.content,
     5517                }));
     5518            },
     5519
     5520            confirm_action: function(e) {
     5521                $( e.currentTarget ).addClass( 'sui-button-onload' );
     5522            },
     5523
     5524        });
     5525    });
     5526})(jQuery);
     5527
     5528(function ($) {
     5529    formintorjs.define('admin/popup/disconnect-stripe',[
     5530        'text!tpl/dashboard.html',
     5531    ], function (popupTpl) {
     5532        return Backbone.View.extend({
     5533            className: 'wpmudev-section--popup delete-stripe--popup',
     5534
     5535            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-disconnect-stripe-popup-tpl').html()),
     5536
     5537          initialize: function( options ) {
     5538            this.nonce = options.nonce;
     5539            this.referrer = options.referrer;
     5540            this.content = options.content || Forminator.l10n.popup.cannot_be_reverted ;
     5541          },
     5542
     5543          render: function () {
     5544              this.$el.html(this.popupTpl({
     5545                nonce: this.nonce,
     5546                id: this.id,
     5547                referrer: this.referrer,
     5548                content: Forminator.Utils.sanitize_text_field( this.content ),
     5549              }));
     5550           },
     5551        });
     5552    });
     5553})(jQuery);
     5554
     5555(function ($) {
     5556    formintorjs.define('admin/popup/disconnect-paypal',[
     5557        'text!tpl/dashboard.html',
     5558    ], function (popupTpl) {
     5559        return Backbone.View.extend({
     5560            className: 'wpmudev-section--popup',
     5561
     5562            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-disconnect-paypal-popup-tpl').html()),
     5563
     5564          initialize: function( options ) {
     5565            this.nonce = options.nonce;
     5566            this.referrer = options.referrer;
     5567            this.content = options.content || Forminator.l10n.popup.cannot_be_reverted ;
     5568          },
     5569
     5570          render: function () {
     5571              this.$el.html(this.popupTpl({
     5572              nonce: this.nonce,
     5573              id: this.id,
     5574              referrer: this.referrer,
     5575              content: Forminator.Utils.sanitize_text_field( this.content ),
     5576            }));
     5577          },
     5578        });
     5579    });
     5580})(jQuery);
     5581
     5582(function ($) {
     5583    formintorjs.define('admin/popup/approve-user',[
     5584        'text!tpl/dashboard.html',
     5585    ], function (popupTpl) {
     5586        return Backbone.View.extend({
     5587            className: 'wpmudev-section--popup',
     5588
     5589            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-approve-user-popup-tpl').html()),
     5590            events: {
     5591                "click .approve-user.popup-confirmation-confirm" : 'approveUser',
     5592            },
     5593            initialize: function( options ) {
     5594                this.nonce = options.nonce;
     5595                this.referrer = options.referrer;
     5596                this.content = options.content || Forminator.l10n.popup.cannot_be_reverted;
     5597                this.activationKey = options.activationKey;
     5598            },
     5599
     5600            render: function () {
     5601                this.$el.html(this.popupTpl({
     5602                    nonce: this.nonce,
     5603                    id: this.id,
     5604                    referrer: this.referrer,
     5605                    content: this.content,
     5606                    activationKey: this.activationKey,
     5607                }));
     5608            },
     5609
     5610            submitForm: function( $form, nonce, activationKey ) {
     5611                var data = {},
     5612                    self = this
     5613                ;
     5614
     5615                data.action = 'forminator_approve_user_popup';
     5616                data._ajax_nonce = nonce;
     5617                data.activation_key = activationKey;
     5618
     5619                var ajaxData = $form.serialize() + '&' + $.param(data);
     5620
     5621                $.ajax({
     5622                    url: Forminator.Data.ajaxUrl,
     5623                    type: "POST",
     5624                    data: ajaxData,
     5625                    beforeSend: function() {
     5626                        $form.find('.sui-button').addClass('sui-button-onload');
     5627                    },
     5628                    success: function( result ) {
     5629                        if (result && result.success) {
     5630                            Forminator.Notification.open('success', Forminator.l10n.commons.approve_user_successfull, 4000);
     5631                            window.location.reload();
     5632                        } else {
     5633                            Forminator.Notification.open( 'error', result.data, 4000 );
     5634                        }
     5635                    },
     5636                    error: function ( error ) {
     5637                        Forminator.Notification.open( 'error', Forminator.l10n.commons.approve_user_unsuccessfull, 4000 );
     5638                    }
     5639                }).always(function(){
     5640                    $form.find('.sui-button').removeClass('sui-button-onload');
     5641                });
     5642            },
     5643
     5644            approveUser: function(e) {
     5645                e.preventDefault();
     5646
     5647                var $target = $(e.target);
     5648                $target.addClass('sui-button-onload');
     5649
     5650                var popup   = this.$el.find('.form-approve-user');
     5651                var form    = popup.find('form');
     5652
     5653                this.submitForm( form, this.nonce, this.activationKey );
     5654
     5655                return false;
     5656            }
     5657        });
     5658    });
     5659})(jQuery);
     5660
     5661(function ($) {
     5662    formintorjs.define('admin/popup/delete-unconfirmed-user',[
     5663        'text!tpl/dashboard.html',
     5664    ], function (popupTpl) {
     5665        return Backbone.View.extend({
     5666            className: 'wpmudev-section--popup',
     5667
     5668            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-delete-unconfirmed-user-popup-tpl').html()),
     5669            events: {
     5670                "click .delete-unconfirmed-user.popup-confirmation-confirm" : 'deleteUnconfirmedUser',
     5671            },
     5672            initialize: function( options ) {
     5673                this.nonce = options.nonce;
     5674                this.formId = options.formId;
     5675                this.referrer = options.referrer;
     5676                this.content = options.content || Forminator.l10n.popup.cannot_be_reverted ;
     5677                this.activationKey = options.activationKey;
     5678                this.entryId = options.entryId;
     5679            },
     5680
     5681            render: function () {
     5682                this.$el.html(this.popupTpl({
     5683                    nonce: this.nonce,
     5684                    formId: this.formId,
     5685                    referrer: this.referrer,
     5686                    content: this.content,
     5687                    activationKey: this.activationKey,
     5688                    entryId: this.entryId,
     5689                }));
     5690            },
     5691
     5692            submitForm: function( $form, nonce, activationKey, formId, entryId ) {
     5693                var data = {
     5694                    action: 'forminator_delete_unconfirmed_user_popup',
     5695                    _ajax_nonce: nonce,
     5696                    activation_key: activationKey,
     5697                    form_id: formId,
     5698                    entry_id: entryId,
     5699                };
     5700
     5701                var ajaxData = $form.serialize() + '&' + $.param(data);
     5702
     5703                $.ajax({
     5704                    url: Forminator.Data.ajaxUrl,
     5705                    type: "POST",
     5706                    data: ajaxData,
     5707                    beforeSend: function() {
     5708                        $form.find('.sui-button').addClass('sui-button-onload');
     5709                    },
     5710                    success: function( result ) {
     5711                        if (result && result.success) {
     5712                            window.location.reload();
     5713                        } else {
     5714                            Forminator.Notification.open( 'error', result.data, 4000 );
     5715                        }
     5716                    },
     5717                    error: function ( error ) {
     5718                        Forminator.Notification.open( 'error', error.data, 4000 );
     5719                    }
     5720                }).always(function(){
     5721                    $form.find('.sui-button').removeClass('sui-button-onload');
     5722                });
     5723            },
     5724
     5725            deleteUnconfirmedUser: function(e) {
     5726                e.preventDefault();
     5727
     5728                var $target = $(e.target);
     5729                $target.addClass('sui-button-onload');
     5730
     5731                var popup   = this.$el.find('.form-delete-unconfirmed-user');
     5732                var form    = popup.find('form');
     5733
     5734                this.submitForm( form, this.nonce, this.activationKey, this.formId, this.entryId );
     5735
     5736                return false;
     5737            }
     5738        });
     5739    });
     5740})(jQuery);
     5741
     5742(function ($) {
     5743    formintorjs.define('admin/popup/create-appearance-preset',[
     5744        'text!tpl/dashboard.html',
     5745    ], function (popupTpl) {
     5746        return Backbone.View.extend({
     5747            className: 'wpmudev-section--popup',
     5748
     5749            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-create-appearance-preset-tpl').html()),
     5750            events: {
     5751                "click #forminator-create-preset" : 'createPreset',
     5752                "keydown #forminator-preset-name" : 'toggleButton',
     5753            },
     5754            initialize: function( options ) {
     5755                this.nonce = options.nonce;
     5756                this.title = options.title;
     5757                this.content = options.content;
     5758                this.$target = options.$target;
     5759            },
     5760
     5761            render: function () {
     5762                var formLabel= this.$target.data('modal-preset-form-label'),
     5763                    loadingText= this.$target.data('modal-preset-loading-text'),
     5764                    nameLabel= this.$target.data('modal-preset-name-label'),
     5765                    namePlaceholder= this.$target.data('modal-preset-name-placeholder');
     5766
     5767                this.$el.html(this.popupTpl({
     5768                    title: Forminator.Utils.sanitize_text_field( this.title ),
     5769                    content: Forminator.Utils.sanitize_text_field( this.content ),
     5770                    formLabel: Forminator.Utils.sanitize_text_field( formLabel ),
     5771                    loadingText: Forminator.Utils.sanitize_text_field( loadingText ),
     5772                    nameLabel: Forminator.Utils.sanitize_text_field( nameLabel ),
     5773                    namePlaceholder: Forminator.Utils.sanitize_text_field( namePlaceholder ),
     5774                }));
     5775            },
     5776
     5777            toggleButton: function(e) {
     5778                setTimeout( function(){
     5779                    var val = $(e.currentTarget).val().trim();
     5780                    $('#forminator-create-preset').prop( 'disabled', !val );
     5781                }, 300 );
     5782            },
     5783
     5784            createPreset: function(e) {
     5785                e.preventDefault();
     5786                e.stopImmediatePropagation();
     5787
     5788                var $target = $(e.target);
     5789                $target.addClass('sui-button-onload-text');
     5790
     5791                var formId = this.$el.find('select[name="form_id"]').val();
     5792                var name   = this.$el.find('#forminator-preset-name').val();
     5793
     5794                var data = {
     5795                    action: 'forminator_create_appearance_preset',
     5796                    _ajax_nonce: this.nonce,
     5797                    form_id: formId,
     5798                    name: name,
     5799                };
     5800
     5801                $.ajax({
     5802                    url: Forminator.Data.ajaxUrl,
     5803                    type: "POST",
     5804                    data: data,
     5805                    success: function( result ) {
     5806                        if (result && result.success) {
     5807                            Forminator.openPreset( result.data );
     5808                        } else {
     5809                            Forminator.Notification.open( 'error', result.data, 4000 );
     5810                            $target.removeClass('sui-button-onload-text');
     5811                        }
     5812                    },
     5813                    error: function ( error ) {
     5814                        Forminator.Notification.open( 'error', error.data, 4000 );
     5815                        $target.removeClass('sui-button-onload-text');
     5816                    }
     5817                });
     5818
     5819                return false;
     5820            }
     5821        });
     5822    });
     5823})(jQuery);
     5824
     5825(function ($) {
     5826    formintorjs.define('admin/popup/apply-appearance-preset',[
     5827        'text!tpl/dashboard.html',
     5828    ], function (popupTpl) {
     5829        return Backbone.View.extend({
     5830            className: 'wpmudev-section--popup',
     5831
     5832            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-apply-appearance-preset-tpl').html()),
     5833            events: {
     5834                "click #forminator-apply-preset" : 'applyPreset',
     5835            },
     5836            initialize: function( options ) {
     5837                this.$target = options.$target;
     5838            },
     5839
     5840            render: function () {
     5841                this.$el.html(this.popupTpl({
     5842                    description: Forminator.Data.modules.ApplyPreset.description,
     5843                    notice: Forminator.Data.modules.ApplyPreset.notice,
     5844                    button: Forminator.Data.modules.ApplyPreset.button,
     5845                    selectbox: Forminator.Data.modules.ApplyPreset.selectbox,
     5846                }));
     5847            },
     5848
     5849            applyPreset: function(e) {
     5850                e.preventDefault();
     5851                e.stopImmediatePropagation();
     5852
     5853                var $target = $(e.target);
     5854                $target.addClass('sui-button-onload-text');
     5855
     5856                var id = this.$target.data('form-id'),
     5857                    ids = [],
     5858                    presetId = this.$el.find('select[name="appearance_preset"]').val();
     5859
     5860                if ( id ) {
     5861                    ids = [ id ];
     5862                } else {
     5863                    ids = $('#forminator_bulk_ids').val().split(',');
     5864                }
     5865
     5866                var data = {
     5867                    action: 'forminator_apply_appearance_preset',
     5868                    _ajax_nonce: Forminator.Data.modules.ApplyPreset.nonce,
     5869                    preset_id: presetId,
     5870                    ids: ids,
     5871                };
     5872
     5873                $.ajax({
     5874                    url: Forminator.Data.ajaxUrl,
     5875                    type: "POST",
     5876                    data: data,
     5877                    success: function( result ) {
     5878                        if (result && result.success) {
     5879                            Forminator.Notification.open( 'success', result.data, 4000 );
     5880                            Forminator.Popup.close();
     5881                        } else {
     5882                            Forminator.Notification.open( 'error', result.data, 4000 );
     5883                            $target.removeClass('sui-button-onload-text');
     5884                        }
     5885                    },
     5886                    error: function ( error ) {
     5887                        Forminator.Notification.open( 'error', error.data, 4000 );
     5888                        $target.removeClass('sui-button-onload-text');
     5889                    }
     5890                });
     5891
     5892                return false;
     5893            }
     5894        });
     5895    });
     5896})(jQuery);
     5897
     5898(function ($) {
     5899    formintorjs.define('admin/popup/confirm',[
     5900        'text!tpl/dashboard.html',
     5901    ], function (popupTpl) {
     5902        return Backbone.View.extend({
     5903            className: 'wpmudev-section--popup',
     5904
     5905            popupTpl: Forminator.Utils.template($(popupTpl).find('#forminator-confirmation-popup-tpl').html()),
     5906
     5907            default_options: {
     5908                confirmation_message: Forminator.l10n.popup.confirm_action,
     5909                confirmation_title: Forminator.l10n.popup.confirm_title,
     5910                confirm_callback: function () {
     5911                    this.close();
     5912                },
     5913                cancel_callback: function () {
     5914                    this.close();
     5915                }
     5916            },
     5917            confirm_options: {},
     5918            events: {
     5919                "click .popup-confirmation-confirm": "confirm_action",
     5920                "click .popup-confirmation-cancel": "cancel_action"
     5921            },
     5922
     5923            initialize: function (options) {
     5924                this.confirm_options = _.defaults(options, this.default_options);
     5925            },
     5926
     5927            render: function () {
     5928                this.$el.html(this.popupTpl(this.confirm_options));
     5929                return this;
     5930            },
     5931
     5932            confirm_action: function(){
     5933                this.confirm_options.confirm_callback.apply(this, []);
     5934            },
     5935
     5936            cancel_action: function(){
     5937                this.confirm_options.cancel_callback.apply(this, []);
     5938            },
     5939
     5940            close: function () {
     5941                Forminator.Popup.close();
     5942            }
     5943        });
     5944    });
     5945})(jQuery);
     5946
     5947(function ($) {
     5948    formintorjs.define('admin/popup/addons-actions',[
     5949        'text!tpl/dashboard.html',
     5950    ], function( popupTpl ) {
     5951        return Backbone.View.extend({
     5952            className: 'wpmudev-section--popup',
     5953
     5954            popupTpl: Forminator.Utils.template( $( popupTpl ).find( '#forminator-addons-action-popup-tpl' ).html() ),
     5955
     5956            initialize: function( options ) {
     5957                this.nonce = options.nonce;
     5958                this.is_network = options.is_network;
     5959                this.id = options.id;
     5960                this.referrer = options.referrer;
     5961                this.content = options.content || Forminator.l10n.popup.cannot_be_reverted;
     5962                this.forms = options.forms || [];
     5963            },
     5964
     5965            render: function () {
     5966                this.$el.html(this.popupTpl({
     5967                    nonce: this.nonce,
     5968                    is_network: this.is_network,
     5969                    id: this.id,
     5970                    referrer: this.referrer,
     5971                    content: this.content,
     5972                    forms: this.forms,
     5973                }));
     5974            },
     5975        });
     5976    });
     5977})(jQuery);
     5978
     5979
     5980formintorjs.define('text!tpl/reports.html',[],function () { return '<div>\n    <script type="text/template" id="forminator-add-reports-content">\n        <div\n            id="forminator-notifications-slide-settings"\n            class="sui-modal-slide sui-active sui-loaded"\n            data-modal-size="lg"\n        >\n            <div class="sui-box">\n                <div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\n                    <button class="sui-button-icon sui-button-float--right forminator-popup-close">\n                        <span class="sui-icon-close" aria-hidden="true"></span>\n                        <span class="sui-screen-reader-text">Close</span>\n                    </button>\n                    <h3 id="forminator-settings__title" class="sui-box-title sui-lg">\n                        {{ Forminator.l10n.popup.settings_label }}\n                    </h3>\n                    <p id="forminator-settings__description" class="sui-description">\n                        {{ Forminator.l10n.popup.settings_description }}\n                    </p>\n                </div>\n                <div class="sui-box-body reports-settings-content"></div>\n\n                <div class="sui-box-footer sui-content-separated">\n                    <button class="sui-button sui-button-ghost forminator-cancel-report">\n                        <span class="sui-loading-text">{{ Forminator.l10n.popup.cancel }}</span>\n                        <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                    </button>\n                    <button\n                            id="forminator-notifications-slide-settings-next"\n                            class="sui-button forminator-popup-slide"\n                            data-modal-slide="forminator-notifications-slide-schedule"\n                            data-modal-slide-focus=""\n                            data-modal-slide-intro="next"\n                    >\n                        <span class="sui-loading-text">{{ Forminator.l10n.form.continue_button }}</span>\n                    </button>\n                </div>\n            </div>\n        </div>\n        <div\n            id="forminator-notifications-slide-schedule"\n            class="sui-modal-slide"\n            data-modal-size="lg"\n            aria-hidden="true"\n            tabindex="-1"\n        >\n            <div class="sui-box">\n                <div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\n                    <button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\n                        <span class="sui-icon-close sui-md" aria-hidden="true"></span>\n                        <span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\n                    </button>\n\n                    <h3 id="forminator-schedule__title" class="sui-box-title sui-lg">\n                        {{ Forminator.l10n.popup.schedule_label }}\n                    </h3>\n\n                    <p id="forminator-schedule__description" class="sui-description">\n                        {{ Forminator.l10n.popup.schedule_description }}\n                    </p>\n\n                </div>\n\n                <div class="sui-box-body reports-schedule-content"></div>\n                <div class="sui-box-footer sui-content-separated">\n\n                    <button id="forminator-notifications-slide-schedule-back"\n                            class="forminator-popup-slide sui-button sui-button-ghost"\n                            data-modal-slide="forminator-notifications-slide-settings"\n                            data-modal-slide-focus=""\n                            data-modal-slide-intro="back">\n                        <span class="sui-loading-text">{{ Forminator.l10n.popup.back }}</span>\n                        <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                    </button>\n                    <button id="forminator-notifications-slide-schedule-next"\n                            class="sui-button forminator-popup-slide"\n                            data-modal-slide="forminator-notifications-slide-recipients"\n                            data-modal-slide-focus=""\n                            data-modal-slide-intro="next">\n                        <span class="sui-loading-text">{{ Forminator.l10n.quiz.continue_button }}</span>\n                        <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                    </button>\n                </div>\n            </div>\n        </div>\n\n        <div\n                id="forminator-notifications-slide-recipients"\n                class="sui-modal-slide"\n                data-modal-size="lg"\n                aria-hidden="true"\n                tabindex="-1"\n        >\n            <div class="sui-box">\n                <div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\n                    <button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\n                        <span class="sui-icon-close sui-md" aria-hidden="true"></span>\n                        <span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\n                    </button>\n                    <h3 id="forminator-popup__title" class="sui-box-title sui-lg">\n                        {{ Forminator.l10n.popup.recipients_label }}\n                    </h3>\n                    <p id="forminator-popup__description" class="sui-description">\n                        {{ Forminator.l10n.popup.recipients_description }}\n                    </p>\n                </div>\n                <div class="sui-box-body reports-recipients-content"></div>\n                <div class="sui-box-footer sui-content-separated">\n                    <button id="forminator-notifications-slide-recipients-back"\n                            class="forminator-popup-slide sui-button sui-button-ghost"\n                            data-modal-slide="forminator-notifications-slide-schedule"\n                            data-modal-slide-focus=""\n                            data-modal-slide-intro="back">\n                        <span class="sui-loading-text">{{ Forminator.l10n.popup.back }}</span>\n                        <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                    </button>\n                    <div class="report-button-with-toggle">\n                        <label for="notification-status-slide" class="sui-toggle">\n                            <input type="checkbox" id="notification-status-slide" class="notification-save-status"\n                                   aria-labelledby="notification-status-slide-label"\n                                   {{ \'active\' === notification.report_status ? \'checked="checked"\' : \'\' }}>\n                            <span class="sui-toggle-slider" aria-hidden="true"></span>\n                            <span id="notification-status-slide-label" class="sui-toggle-label">\n                                {{ Forminator.l10n.popup.status_label }}\n                            </span>\n                        </label>\n                        <button class="sui-button forminator-report-save sui-button-blue" data-id="0">\n                            <span class="sui-loading-text">{{ Forminator.l10n.popup.save_changes }}</span>\n                            <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                        </button>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </script>\n    <script type="text/template" id="forminator-reports-settings-content">\n        <div>\n            <div class="sui-box-settings-row">\n                <div class="sui-box-settings-col-2">\n                    <div class="sui-form-field">\n                        <label for="report-title"\n                               id="label-report-title" class="sui-label">\n                            {{ Forminator.l10n.commons.label }}\n                        </label>\n                        <input\n                                placeholder="Placeholder"\n                                id="report-title"\n                                name="label"\n                                value="{{ settings.label }}"\n                                class="sui-form-control"\n                                aria-labelledby="label-report-title"\n                                aria-describedby="error-report-title description-report-title"\n                        />\n                        <span id="description-report-title" class="sui-description">\n                            {{ Forminator.l10n.popup.label_description }}\n                        </span>\n                    </div>\n                </div>\n            </div>\n            <div class="sui-box-settings-row">\n                <div class="sui-box-settings-col-2">\n                    <label class="sui-settings-label">\n                        {{ Forminator.l10n.commons.module }}\n                    </label>\n                    <span class="sui-description">\n                       {{ Forminator.l10n.popup.module_description }}\n                    </span>\n                    <div class="sui-form-field">\n                        <div class="sui-side-tabs">\n                            <div class="sui-tabs-menu">\n                                <label for="module_forms" class="sui-tab-item {{ \'forms\' === settings.module ? \'active\' : \'\' }}">\n                                    <input type="radio"\n                                           name="module"\n                                           id="module_forms"\n                                           value="forms"\n                                           aria-controls="module_forms__content"\n                                           data-tab-menu="report-module">\n                                    {{ Forminator.l10n.popup.forms }}\n                                </label>\n                                <label for="module_quizzes" class="sui-tab-item {{ \'quizzes\' === settings.module ? \'active\' : \'\' }}">\n                                    <input type="radio"\n                                           name="module"\n                                           id="module_quizzes"\n                                           value="quizzes"\n                                           aria-controls="module_quizzes__content"\n                                           data-tab-menu="report-module">\n                                    {{ Forminator.l10n.popup.quizzes }}\n                                </label>\n                                <label for="module_polls" class="sui-tab-item {{ \'polls\' === settings.module ? \'active\' : \'\' }}">\n                                    <input type="radio"\n                                           name="module"\n                                           id="module_polls"\n                                           value="polls"\n                                           aria-controls="module_polls__content"\n                                           data-tab-menu="report-module">\n                                    {{ Forminator.l10n.popup.polls }}\n                                </label>\n                            </div>\n    \n                            <div class="sui-tabs-content">\n    \n                                <div role="tabpanel" id="module_forms__content"\n                                     class="sui-tab-content {{ \'forms\' === settings.module ? \'active\' : \'\' }}"\n                                     aria-labelledby="module_forms__tab" tabindex="0"\n                                     data-tab-content="report-module">\n                                    <div class="sui-border-frame">\n                                        <label class="sui-settings-label sui-sm">\n                                            {{ Forminator.l10n.popup.select_forms }}\n                                        </label>\n    \n                                        <span class="sui-description">\n                                            {{ Forminator.l10n.popup.select_forms_description }}\n                                        </span>\n    \n                                        <div class="sui-form-field">\n    \n                                            <div class="sui-side-tabs">\n                                                <div class="sui-tabs-menu">\n                                                    <label for="all_forms" class="sui-tab-item {{ undefined === settings.forms_type || \'all\' === settings.forms_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="forms_type"\n                                                               id="all_forms"\n                                                               value="all"\n                                                               aria-controls="all_forms__content"\n                                                               data-tab-menu="select-form">\n                                                        {{ Forminator.l10n.popup.all_forms }}\n                                                    </label>\n                                                    <label for="selected_forms" class="sui-tab-item {{ \'selected\' === settings.forms_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="forms_type"\n                                                               id="selected_forms"\n                                                               value="selected"\n                                                               aria-controls="selected_forms__content"\n                                                               data-tab-menu="select-form">\n                                                        {{ Forminator.l10n.popup.selected_forms }}\n                                                    </label>\n                                                </div>\n    \n                                                <div class="sui-tabs-content">\n    \n                                                    <div role="tabpanel" id="selected_forms__content"\n                                                         class="sui-tab-content {{ \'selected\' === settings.forms_type ? \'active\' : \'\' }}"\n                                                         aria-labelledby="selected_forms" tabindex="0" hidden\n                                                         data-tab-content="select-form">\n                                                        <div class="sui-border-frame">\n                                                            <div class="sui-form-field">\n                                                                <label class="sui-label">\n                                                                    {{ Forminator.l10n.popup.select_forms }}\n                                                                </label>\n    \n                                                                <select name="select_forms" class="sui-select" multiple>\n                                                                    {[ let selected_form = settings.selected_forms;\n                                                                    _.each(Forminator.Data.form_modules, function(forms){ ]}\n                                                                        <option value="{{ forms.id }}"\n                                                                            {[ if( undefined !== selected_form && selected_form.indexOf(forms.id.toString()) !== -1 ) { ]}\n                                                                                selected="selected"\n                                                                            {[ } ]}>\n                                                                            {{ forms.name }}\n                                                                        </option>\n                                                                    {[ }); ]}\n                                                                </select>\n    \n                                                                <p id="selected-forms-description" class="sui-description">\n                                                                    {{ Forminator.l10n.popup.selected_forms_description }}\n                                                                </p>\n                                                            </div>\n                                                        </div>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                </div>\n    \n                                <div role="tabpanel" id="module_quizzes__content"\n                                     class="sui-tab-content {{ \'quizzes\' === settings.module ? \'active\' : \'\' }}"\n                                     aria-labelledby="module_quizzes__tab" tabindex="0" hidden\n                                     data-tab-content="report-module">\n                                    <div class="sui-border-frame">\n                                        <label class="sui-settings-label sui-sm">\n                                            {{ Forminator.l10n.popup.select_quizzes }}\n                                        </label>\n    \n                                        <span class="sui-description">\n                                            {{ Forminator.l10n.popup.select_quizzes_description }}\n                                        </span>\n    \n                                        <div class="sui-form-field">\n    \n                                            <div class="sui-side-tabs">\n                                                <div class="sui-tabs-menu">\n                                                    <label for="all_quizzes" class="sui-tab-item {{ undefined === settings.quizzes_type || \'all\' === settings.quizzes_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="quizzes_type"\n                                                               id="all_quizzes"\n                                                               value="all"\n                                                               aria-controls="all_quizzes__content"\n                                                               data-tab-menu="select-quiz">\n                                                        {{ Forminator.l10n.popup.all_quizzes }}\n                                                    </label>\n                                                    <label for="selected_quizzes" class="sui-tab-item {{ \'selected\' === settings.quizzes_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="quizzes_type"\n                                                               id="selected_quizzes"\n                                                               value="selected"\n                                                               aria-controls="selected_quizzes__content"\n                                                               data-tab-menu="select-quiz">\n                                                        {{ Forminator.l10n.popup.selected_quizzes }}\n                                                    </label>\n                                                </div>\n    \n                                                <div class="sui-tabs-content">\n    \n                                                    <div role="tabpanel" id="selected_quizzes__content"\n                                                         class="sui-tab-content {{ \'selected\' === settings.quizzes_type ? \'active\' : \'\' }}"\n                                                         aria-labelledby="selected_quizzes__tab" tabindex="0" hidden\n                                                         data-tab-content="select-quiz">\n                                                        <div class="sui-border-frame">\n                                                            <div class="sui-form-field">\n                                                                <label class="sui-label">\n                                                                    {{ Forminator.l10n.popup.select_quizzes }}\n                                                                </label>\n    \n                                                                <select name="select_quizzes" class="sui-select" multiple>\n                                                                    {[ let selected_quiz = settings.selected_quizzes;\n                                                                    _.each(Forminator.Data.quiz_modules, function(quizzes){ ]}\n                                                                        <option value="{{ quizzes.id }}"\n                                                                        {[ if( undefined !== selected_quiz && selected_quiz.indexOf(quizzes.id.toString()) !== -1 ) { ]}selected="selected"{[ } ]}>\n                                                                            {{ quizzes.name }}\n                                                                        </option>\n                                                                    {[ }); ]}\n                                                                </select>\n    \n                                                                <p id="selected-quizzes-description" class="sui-description">\n                                                                    {{ Forminator.l10n.popup.selected_quizzes_description }}\n                                                                </p>\n                                                            </div>\n                                                        </div>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                </div>\n    \n                                <div role="tabpanel" id="module_polls__content"\n                                     class="sui-tab-content {{ \'polls\' === settings.module ? \'active\' : \'\' }}"\n                                     aria-labelledby="module_polls__tab" tabindex="0" hidden\n                                     data-tab-content="report-module">\n                                    <div class="sui-border-frame">\n                                        <label class="sui-settings-label sui-sm">\n                                            {{ Forminator.l10n.popup.select_polls }}\n                                        </label>\n    \n                                        <span class="sui-description">\n                                            {{ Forminator.l10n.popup.select_polls_description }}\n                                        </span>\n    \n                                        <div class="sui-form-field">\n    \n                                            <div class="sui-side-tabs">\n                                                <div class="sui-tabs-menu">\n                                                    <label for="all_polls" class="sui-tab-item {{ undefined === settings.polls_type || \'all\' === settings.polls_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="polls_type"\n                                                               id="all_polls"\n                                                               value="all"\n                                                               aria-controls="all_polls__content"\n                                                               data-tab-menu="select-poll">\n                                                        {{ Forminator.l10n.popup.all_polls }}\n                                                    </label>\n                                                    <label for="all_polls" class="sui-tab-item {{ \'selected\' === settings.polls_type ? \'active\' : \'\' }}">\n                                                        <input type="radio"\n                                                               name="polls_type"\n                                                               id="selected_polls"\n                                                               value="selected"\n                                                               aria-controls="selected_polls__content"\n                                                               data-tab-menu="select-quiz">\n                                                        {{ Forminator.l10n.popup.selected_polls }}\n                                                    </label>\n                                                </div>\n    \n                                                <div class="sui-tabs-content">\n    \n                                                    <div role="tabpanel" id="selected_polls__content"\n                                                         class="sui-tab-content {{ \'selected\' === settings.polls_type ? \'active\' : \'\' }}"\n                                                         aria-labelledby="selected_polls__tab" tabindex="0" hidden\n                                                         data-tab-content="select-quiz">\n                                                        <div class="sui-border-frame">\n                                                            <div class="sui-form-field">\n                                                                <label class="sui-label">\n                                                                    {{ Forminator.l10n.popup.select_polls }}\n                                                                </label>\n    \n                                                                <select name="select_polls" class="sui-select" multiple>\n                                                                    {[ let selected_polls = settings.selected_polls;\n                                                                    _.each(Forminator.Data.poll_modules, function(polls){ ]}\n                                                                        <option value="{{ polls.id }}"\n                                                                         {[ if( undefined !== selected_polls && selected_polls.indexOf(polls.id.toString()) !== -1 ) { ]}selected="selected"{[ } ]}>\n                                                                            {{ polls.name }}\n                                                                        </option>\n                                                                    {[ }); ]}\n                                                                </select>\n    \n                                                                <p id="selected-poll-description" class="sui-description">\n                                                                    {{ Forminator.l10n.popup.selected_polls_description }}\n                                                                </p>\n                                                            </div>\n                                                        </div>\n                                                    </div>\n                                                </div>\n                                            </div>\n                                        </div>\n                                    </div>\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </script>\n    <script type="text/template" id="forminator-reports-schedule-content">\n        <div class="sui-box-settings-row">\n\n            <div class="sui-box-settings-col-2">\n                <div class="sui-side-tabs">\n                    <div class="sui-tabs-menu">\n                        <label for="frequency_daily" class="sui-tab-item {{ \'daily\' === schedule.frequency ? \'active\' : \'\' }}">\n                            <input type="radio"\n                                   id="frequency_daily"\n                                   name="frequency"\n                                   aria-controls="frequency_daily__content"\n                                   value="daily"\n                                   data-tab-menu="report-frequency">\n                            {{ Forminator.l10n.popup.daily }}\n                        </label>\n                        <label for="frequency_weekly" class="sui-tab-item {{ \'weekly\' === schedule.frequency ? \'active\' : \'\' }}">\n                            <input type="radio"\n                                   name="frequency"\n                                   id="frequency_weekly"\n                                   aria-controls="frequency_weekly__content"\n                                   value="weekly"\n                                   data-tab-menu="report-frequency">\n                            {{ Forminator.l10n.popup.weekly }}\n                        </label>\n                        <label for="frequency_monthly" class="sui-tab-item {{ \'monthly\' === schedule.frequency ? \'active\' : \'\' }}">\n                            <input type="radio"\n                                   name="frequency"\n                                   id="frequency_monthly"\n                                   aria-controls="frequency_monthly__content"\n                                   value="monthly"\n                                   data-tab-menu="report-frequency">\n                            {{ Forminator.l10n.popup.monthly }}\n                        </label>\n                    </div>\n\n                    <div class="sui-tabs-content">\n\n                        <div role="tabpanel" id="frequency_daily__content" class="sui-tab-content\n                            {{ \'daily\' === schedule.frequency ? \'active\' : \'\' }}"\n                             aria-labelledby="frequency_daily__tab" tabindex="0"\n                             data-tab-content="report-frequency">\n                            <div class="sui-border-frame">\n                                <div class="sui-form-field sui-no-margin-bottom">\n                                    <label class="sui-label" for="report-time">\n                                        {{ Forminator.l10n.popup.day_time }}\n                                    </label>\n                                    <select name="report-time" id="report-time" class="sui-select">\n                                        {[ _.each(Forminator.l10n.popup.time_interval, function(interval){ ]}\n                                        <option value="{{ interval }}"\n                                            {[ if( undefined !== schedule.time && schedule.time === interval ) { ]}\n                                                selected="selected"\n                                            {[ } ]}\n                                        >{{ interval }}</option>\n                                        {[ }); ]}\n                                    </select>\n                                    <p id="select-single-frequency_time" class="sui-description">\n                                        {{ Forminator.l10n.popup.frequency_time }}\n                                    </p>\n                                </div>\n                            </div>\n                        </div>\n\n                        <div role="tabpanel" id="frequency_weekly__content" class="sui-tab-content\n                            {{ \'weekly\' === schedule.frequency ? \'active\' : \'\' }}"\n                             aria-labelledby="frequency_weekly__tab" tabindex="0" hidden\n                             data-tab-content="report-frequency">\n                            <div class="sui-border-frame">\n                                <div class="sui-row sui-no-margin-bottom schedule-box">\n                                    <div class="sui-col sui-form-field sui-no-margin-bottom">\n                                        <label class="sui-label" for="week-days">\n                                            {{ Forminator.l10n.popup.week_day }}\n                                        </label>\n                                        <select name="week-days" class="sui-select" id="week-days">\n                                            {[ _.each(Forminator.l10n.popup.week_days, function(week, days){ ]}\n                                            <option value="{{ days }}"\n                                                {[ if( undefined !== schedule.weekDay && schedule.weekDay === days ) { ]}\n                                                    selected="selected"\n                                                {[ } ]}\n                                            >{{ week }}</option>\n                                            {[ }); ]}\n                                        </select>\n                                    </div>\n                                    <div class="sui-col sui-form-field sui-no-margin-bottom">\n                                        <label class="sui-label" for="week-time">\n                                            {{ Forminator.l10n.popup.day_time }}\n                                        </label>\n                                        <select name="week-time" class="sui-select" id="week-time">\n                                            {[ _.each(Forminator.l10n.popup.time_interval, function(interval){ ]}\n                                            <option value="{{ interval }}"\n                                                {[ if( undefined !== schedule.weekTime && schedule.weekTime === interval ) { ]}\n                                                    selected="selected"\n                                                {[ } ]}\n                                            >{{ interval }}</option>\n                                            {[ }); ]}\n                                        </select>\n                                    </div>\n                                    <p id="select-single-default-helper" class="sui-col-12 sui-description">\n                                        {{ Forminator.l10n.popup.frequency_time }}\n                                    </p>\n                                </div>\n                            </div>\n                        </div>\n\n                        <div role="tabpanel" id="frequency_monthly__content" class="sui-tab-content\n                            {{ \'monthly\' === schedule.frequency ? \'active\' : \'\' }}"\n                             aria-labelledby="frequency_monthly__tab" tabindex="0" hidden\n                             data-tab-content="report-frequency">\n                            <div class="sui-border-frame">\n                                <div class="sui-row sui-no-margin-bottom schedule-box">\n                                    <div class="sui-col sui-form-field sui-no-margin-bottom">\n                                        <label class="sui-label" for="week-days">\n                                            {{ Forminator.l10n.popup.month_day }}\n                                        </label>\n                                        <select name="month-days" class="sui-select" id="month-days">\n                                            {[ _.each(Forminator.l10n.popup.month_days, function(month){ ]}\n                                            <option value="{{ month }}"\n                                                {[ if( undefined !== schedule.monthDay && schedule.monthDay === month.toString() ) { ]}\n                                                    selected="selected"\n                                                {[ } ]}\n                                            >{{ month }}</option>\n                                            {[ }); ]}\n                                        </select>\n                                    </div>\n                                    <div class="sui-col sui-form-field sui-no-margin-bottom">\n                                        <label class="sui-label" for="week-time">\n                                            {{ Forminator.l10n.popup.day_time }}\n                                        </label>\n                                        <select name="month-time" class="sui-select" id="month-time">\n                                            {[ _.each(Forminator.l10n.popup.time_interval, function(interval){ ]}\n                                            <option value="{{ interval }}"\n                                                {[ if( undefined !== schedule.monthTime && schedule.monthTime === interval ) { ]}\n                                                    selected="selected"\n                                                {[ } ]}\n                                            >{{ interval }}</option>\n                                            {[ }); ]}\n                                        </select>\n                                    </div>\n                                    <p id="select-month-default-helper" class="sui-col-12 sui-description">\n                                        {{ Forminator.l10n.popup.frequency_time }}\n                                    </p>\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </script>\n    <script type="text/template" id="forminator-reports-recipients-content">\n        <div class="sui-box-settings-row">\n            <div class="sui-box-settings-col-2">\n                <div class="sui-tabs sui-tabs-overflow">\n                    <div role="tablist" class="sui-tabs-menu">\n                        <button type="button" role="tab" id="notifications-add-users" class="sui-tab-item active"\n                                aria-controls="notifications-add-users-content" aria-selected="true">\n                            {{ Forminator.l10n.popup.add_users }}\n                        </button>\n                        <button type="button" role="tab" id="notifications-invite-users" class="sui-tab-item"\n                                aria-controls="notifications-invite-users-content" aria-selected="false" tabindex="-1">\n                            {{ Forminator.l10n.popup.add_by_email }}\n                        </button>\n                    </div>\n                    <div class="sui-tabs-content">\n                        <div role="tabpanel" tabindex="0" id="notifications-add-users-content"\n                             class="sui-tab-content active" aria-labelledby="notifications-add-users">\n                            <div class="sui-form-field sui-no-margin-bottom">\n                                <label for="forminator-search-users" class="sui-label">\n                                    {{ Forminator.l10n.popup.search_user }}\n                                </label>\n                                <select id="forminator-search-users" class="sui-select" data-theme="search"\n                                        data-placeholder="{{ Forminator.l10n.popup.search_placeholder }}"\n                                        multiple>\n                                </select>\n                            </div>\n                            {[ const hasUserRecipients = recipients.find( r => undefined !== r.role && \'\' !== r.role ); ]}\n                            <div class="{{ undefined === hasUserRecipients ? \'sui-hidden\' : \'sui-margin-top\' }}">\n                                <strong>{{ Forminator.l10n.popup.added_users }}</strong>\n                                <div class="sui-recipients" id="modal-user-recipients-list">\n                                    {[ for ( const recipient of recipients ) {\n                                    if ( \'\' !== recipient.role ) { ]}\n                                    <div class="sui-recipient sui-recipient-rounded" data-id="{{ recipient.id }}" data-email="{{ recipient.email }}">\n                                        {[ let subClass = \'\';\n                                        if ( \'undefined\' !== typeof recipient.is_pending ) {\n                                        if ( ! recipient.is_pending && \'undefined\' !== typeof recipient.is_subscribed && ! recipient.is_subscribed ) {\n                                        subClass = \'unsubscribed\';\n                                        } else {\n                                        subClass = recipient.is_pending ? \'pending\' : \'confirmed\';\n                                        }\n                                        } ]}\n                                        <span class="sui-recipient-name">\n                                            <span class="subscriber {{ subClass }}">\n                                                {[ if ( \'pending\' === subClass ) { ]}\n                                                <span class="sui-tooltip" data-tooltip="{{ Forminator.l10n.popup.awaiting_confirmation }}">\n                                                {[ } ]}\n                                                    <img src="{{ recipient.avatar }}" alt="{{ recipient.email }}">\n                                                {[ if ( \'pending\' === subClass ) { ]}\n                                                </span>\n                                                 {[ } ]}\n                                            </span>\n                                            <span class="forminator-recipient-name">{{ recipient.name }}</span>\n                                        </span>\n                                        <span class="sui-recipient-email">{{ recipient.role }}</span>\n                                        {[ if ( \'pending\' === subClass || \'unsubscribed\' === subClass ) { ]}\n                                        <button\n                                                type="button"\n                                                class="resend-invite sui-button-icon sui-tooltip"\n                                                data-tooltip="{{ Forminator.l10n.popup.resend_invite }}"\n                                        >\n                                            <span class="sui-icon-send" aria-hidden="true"></span>\n                                        </button>\n                                        {[ } ]}\n                                        <button\n                                                type="button"\n                                                class="sui-button-icon sui-tooltip forminator-remove-recipient"\n                                                data-tooltip="{{ Forminator.l10n.popup.remove_user }}"\n                                                data-id="{{ recipient.id }}"\n                                                data-email="{{ recipient.email }}"\n                                                data-type="user">\n                                            <span class="sui-icon-trash" aria-hidden="true"></span>\n                                        </button>\n                                    </div>\n                                    {[ } ]}\n                                    {[ } ]}\n                                </div>\n                            </div>\n                            <div class="sui-margin-top sui-hidden">\n                                <strong>{{ Forminator.l10n.popup.users }}</strong>\n                                <div class="sui-recipients" id="forminator-user-list"></div>\n                            </div>\n                            <div class="sui-notice sui-notice-warning sui-margin-top notifications-recipients-notice sui-hidden">\n                                <div class="sui-notice-content">\n                                    <div class="sui-notice-message">\n                                        <span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\n                                        <p></p>\n                                    </div>\n                                </div>\n                            </div>\n                        </div>\n                        <div role="tabpanel" tabindex="0" id="notifications-invite-users-content" class="sui-tab-content" aria-labelledby="notifications-invite-users" hidden>\n                            <p class="sui-description">\n                                {{ Forminator.l10n.popup.invite_description }}\n                            </p>\n                            <div class="sui-form-field">\n                                <label for="recipient-name" id="label-recipient-name" class="sui-label">\n                                    {{ Forminator.l10n.popup.first_name }}\n                                </label>\n\n                                <input\n                                        placeholder="{{ Forminator.l10n.popup.name_placeholder }}"\n                                        id="recipient-name"\n                                        class="sui-form-control"\n                                        aria-labelledby="label-recipient-name"\n                                />\n                            </div>\n\n                            <div class="sui-form-field">\n                                <label for="recipient-email" id="label-recipient-email" class="sui-label">\n                                    {{ Forminator.l10n.popup.email_address }}\n                                </label>\n\n                                <input\n                                        placeholder="{{ Forminator.l10n.popup.email_placeholder }}"\n                                        id="recipient-email"\n                                        class="sui-form-control"\n                                        aria-labelledby="label-recipient-email"\n                                />\n                                <span id="error-recipient-email" class="sui-error-message" role="alert"></span>\n                            </div>\n\n                            <div class="sui-form-field sui-no-margin-bottom">\n                                <button type="button" id="add-recipient-button" class="sui-button" aria-live="polite" disabled="disabled">\n                                    <span class="sui-button-text-default">{{ Forminator.l10n.popup.add_recipient }}</span>\n                                    <span class="sui-button-text-onload">\n                                        <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>\n                                        {{ Forminator.l10n.popup.adding_recipient }}\n                                    </span>\n                                </button>\n                            </div>\n\n                            {[ const hasInvitedRecipients = recipients.find( r => undefined === r.role || \'\' === r.role ); ]}\n                            <div class="{{ undefined === hasInvitedRecipients ? \'sui-hidden\' : \'sui-margin-top\' }}">\n                                <strong>{{ Forminator.l10n.popup.added_users }}</strong>\n                                <div class="sui-recipients" id="modal-email-recipients-list">\n                                    {[ for ( const recipient of recipients ) {\n                                    if ( undefined === recipient.role || \'\' === recipient.role ) { ]}\n                                    <div class="sui-recipient sui-recipient-rounded" data-id="{{ recipient.id }}" data-email="{{ recipient.email }}">\n                                        {[ let subClass = \'\';\n                                        if ( \'undefined\' !== typeof recipient.is_pending ) {\n                                        if ( ! recipient.is_pending && \'undefined\' !== typeof recipient.is_subscribed && ! recipient.is_subscribed ) {\n                                        subClass = \'unsubscribed\';\n                                        } else {\n                                        subClass = recipient.is_pending ? \'pending\' : \'confirmed\';\n                                        }\n                                        } ]}\n                                        <span class="sui-recipient-name">\n                                            <span class="subscriber {{ subClass }}">\n                                                {[ if ( \'pending\' === subClass ) { ]}\n                                                    <span class="sui-tooltip" data-tooltip="{{ Forminator.l10n.popup.awaiting_confirmation }}">\n                                                {[ } ]}\n                                                    <img src="{{ recipient.avatar }}" alt="{{ recipient.email }}">\n                                                {[ if ( \'pending\' === subClass ) { ]}\n                                                    </span>\n                                                {[ } ]}\n                                            </span>\n                                            <span>{{ recipient.name }}</span>\n                                        </span>\n                                        <span class="sui-recipient-email">{{ recipient.email }}</span>\n                                        {[ if ( \'pending\' === subClass || \'unsubscribed\' === subClass ) { ]}\n                                        <button\n                                                type="button"\n                                                class="resend-invite sui-button-icon sui-tooltip"\n                                                data-tooltip="{{ Forminator.l10n.popup.resend_invite }}"\n                                                data-name="{{ recipient.name }}"\n                                                data-email="{{ recipient.email }}">\n                                            <span class="sui-icon-send" aria-hidden="true"></span>\n                                        </button>\n                                        {[ } ]}\n                                        <button\n                                                type="button"\n                                                class="sui-button-icon sui-tooltip forminator-remove-recipient"\n                                                data-tooltip="{{ Forminator.l10n.popup.remove_user }}"\n                                                data-id="{{ recipient.id }}"\n                                                data-email="{{ recipient.email }}"\n                                                data-type="email">\n                                            <span class="sui-icon-trash" aria-hidden="true"></span>\n                                        </button>\n                                    </div>\n                                    {[ } ]}\n                                    {[ } ]}\n                                </div>\n                            </div>\n\n                            <div class="sui-notice sui-notice-warning sui-margin-top notifications-recipients-notice sui-hidden">\n                                <div class="sui-notice-content">\n                                    <div class="sui-notice-message">\n                                        <span class="sui-notice-icon sui-icon-info" aria-hidden="true"></span>\n                                        <p></p>\n                                    </div>\n                                </div>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </script>\n    <script type="text/template" id="forminator-edit-reports-content">\n        <div class="sui-box">\n            <div class="sui-box-header">\n                <h3 id="notification-modal-title" class="sui-box-title">{{ Forminator.l10n.popup.configure }}</h3>\n\n                <div class="sui-actions-right">\n                    <button class="sui-button-icon forminator-popup-close">\n                        <span class="sui-icon-close" aria-hidden="true"></span>\n                        <span class="sui-screen-reader-text">Close this modal</span>\n                    </button>\n                </div>\n\n            </div>\n\n            <div class="sui-box-body">\n                <div class="sui-tabs sui-tabs-flushed">\n                    <div role="tablist" class="sui-tabs-menu">\n                        <button type="button" role="tab" id="report-tab-settings"\n                                class="sui-tab-item active" aria-controls="report-tab-settings-content"\n                                aria-selected="true">\n                            {{ Forminator.l10n.popup.settings_label }}\n                        </button>\n\n                        <button type="button" role="tab" id="report-tab-schedule"\n                                class="sui-tab-item" aria-controls="report-tab-schedule-content"\n                                aria-selected="false" tabindex="-1">\n                            {{ Forminator.l10n.popup.schedule_label }}\n                        </button>\n\n                        <button type="button" role="tab" id="report-tab-recipients"\n                                class="sui-tab-item" aria-controls="report-tab-recipients-content"\n                                aria-selected="false" tabindex="-1">\n                            {{ Forminator.l10n.popup.recipients_label }}\n                        </button>\n                    </div>\n\n                    <div class="sui-tabs-content">\n                        <div role="tabpanel" tabindex="0" id="report-tab-settings-content"\n                             class="sui-tab-content reports-settings-content active" aria-labelledby="report-tab-settings">\n                        </div>\n                        <div role="tabpanel" tabindex="0" id="report-tab-schedule-content"\n                             class="sui-tab-content reports-schedule-content" aria-labelledby="report-tab-schedule">\n                        </div>\n                        <div role="tabpanel" tabindex="0" id="report-tab-recipients-content"\n                             class="sui-tab-content reports-recipients-content" aria-labelledby="report-tab-recipients">\n                        </div>\n                    </div>\n                </div>\n            </div>\n\n            <div class="sui-box-footer sui-content-separated">\n                <button class="sui-button sui-button-ghost forminator-cancel-report">\n                    <span class="sui-loading-text">{{ Forminator.l10n.popup.cancel }}</span>\n                    <i class="sui-icon-load sui-loading" aria-hidden="true"></i>\n                </button>\n                <div class="report-button-with-toggle">\n                    <label for="notification-tab-status" class="sui-toggle">\n                        <input type="checkbox" id="notification-tab-status" class="notification-save-status"\n                               aria-labelledby="notification-tab-status-label"\n                               {{ \'active\' === notification.report_status ? \'checked="checked"\' : \'\' }}>\n                        <span class="sui-toggle-slider" aria-hidden="true"></span>\n                        <span id="notification-tab-status-label" class="sui-toggle-label">\n                            {{ Forminator.l10n.popup.status_label }}\n                        </span>\n                    </label>\n                    <button type="button" class="sui-button sui-button-blue forminator-report-save" aria-live="polite"\n                            data-id="{{ notification.report_id }}">\n                        <span class="sui-button-text-default">\n                            <span class="sui-icon-save" aria-hidden="true"></span>\n                            {{ Forminator.l10n.popup.save_changes }}\n                        </span>\n                        <span class="sui-button-text-onload">\n                            <span class="sui-icon-loader sui-loading" aria-hidden="true"></span>\n                            {{ Forminator.l10n.popup.saving_changes }}\n                        </span>\n                    </button>\n                </div>\n            </div>\n        </div>\n    </script>\n</div>';});
     5981
     5982(function ($) {
     5983    formintorjs.define('admin/popup/reports-notification',[
     5984        'text!tpl/reports.html',
     5985    ], function( popupTpl ) {
     5986        return Backbone.View.extend({
     5987            className: 'forminator-popup-create--report-notification',
     5988
     5989            events: {
     5990                'click label.sui-tab-item': 'inputTabs',
     5991                "click .forminator-popup-close": "close",
     5992                "click .forminator-cancel-report": "close",
     5993                "click button.forminator-popup-slide": "slide_modal",
     5994                "click button.forminator-add-recipient": "add_recipient",
     5995                "click button.forminator-remove-recipient": "remove_recipient",
     5996                "click button#add-recipient-button": "invite_add_recipient",
     5997                "click button.forminator-report-save": "report_save",
     5998            },
     5999
     6000            initialize: function( options ) {
     6001                this.report_id = options.report_id;
     6002            },
     6003
     6004            reportAddPopup: Forminator.Utils.template( $( popupTpl ).find( '#forminator-add-reports-content' ).html()),
     6005            reportEditPopup: Forminator.Utils.template( $( popupTpl ).find( '#forminator-edit-reports-content' ).html()),
     6006            settingsPopup: Forminator.Utils.template( $( popupTpl ).find( '#forminator-reports-settings-content' ).html()),
     6007            schedulePopup: Forminator.Utils.template( $( popupTpl ).find( '#forminator-reports-schedule-content' ).html()),
     6008            recipientsPopup: Forminator.Utils.template( $( popupTpl ).find( '#forminator-reports-recipients-content' ).html()),
     6009
     6010            notification: {
     6011                report_id: 0,
     6012                exclude: [],
     6013                settings: {
     6014                    label: forminatorl10n.popup.form_reports,
     6015                    module: 'forms',
     6016                    forms_type: 'all',
     6017                },
     6018                schedule: {
     6019                    frequency: 'daily',
     6020                },
     6021                report_status: 'active',
     6022                recipients: [],
     6023            },
     6024
     6025            render: function() {
     6026                if ( 0 !== this.report_id ) {
     6027                    var div_preloader = '';
     6028                    if ('sui-box-body' !== this.className) {
     6029                        div_preloader += '<div class="sui-box-body">';
     6030                    }
     6031                    div_preloader +=
     6032                        '<p class="fui-loading-dialog" aria-label="Loading content">' +
     6033                            '<i class="sui-icon-loader sui-loading" aria-hidden="true"></i>' +
     6034                        '</p>'
     6035                    ;
     6036                    if ('sui-box-body' !== this.className) {
     6037                        div_preloader += '</div>';
     6038                    }
     6039
     6040                    this.$el.html(div_preloader);
     6041
     6042                    this.fetch_report_data( this.report_id );
     6043                } else {
     6044                    this.load_users();
     6045                    this.$el.html( this.reportAddPopup({
     6046                        notification: this.notification
     6047                    }) );
     6048                    this.render_html();
     6049                }
     6050            },
     6051
     6052            render_html: function () {
     6053                var self = this;
     6054                this.render_content();
     6055                setTimeout(function() {
     6056                    self.initSUI();
     6057                    self.mapActions();
     6058                }, 500);
     6059            },
     6060
     6061            render_content: function () {
     6062                this.$el.find('.reports-settings-content').html( this.settingsPopup({
     6063                    settings: this.notification.settings
     6064                }) );
     6065                this.$el.find('.reports-schedule-content').html( this.schedulePopup({
     6066                    schedule: this.notification.schedule
     6067                }) );
     6068                this.$el.find('.reports-recipients-content').html( this.recipientsPopup({
     6069                    recipients: this.notification.recipients
     6070                }) );
     6071            },
     6072
     6073            initSUI: function() {
     6074                $( '.sui-select' ).each( function() {
     6075                    const select = $( this );
     6076                    if ( 'search' === select.data( 'theme' ) ) {
     6077                        SUI.select.initSearch( select );
     6078                    } else {
     6079                        SUI.select.init( select );
     6080                    }
     6081                } );
     6082                SUI.tabs();
     6083            },
     6084
     6085            mapActions: function () {
     6086                this.initUserSelects();
     6087                this.toggleAddButton();
     6088            },
     6089
     6090            slide_modal: function( e ) {
     6091                e.preventDefault();
     6092
     6093                const newSlideId     = $( e.currentTarget ).data( 'modal-slide' ),
     6094                    newSlideFocus    = $( e.currentTarget ).data( 'modal-slide-focus' ),
     6095                    newSlideEntrance = $( e.currentTarget ).data( 'modal-slide-intro' )
     6096                ;
     6097
     6098                SUI.slideModal( newSlideId, newSlideFocus, newSlideEntrance );
     6099            },
     6100
     6101            close: function( e ) {
     6102                e.preventDefault();
     6103
     6104                Forminator.Popup.close();
     6105            },
     6106
     6107            toggleAddButton: function () {
     6108                const inputs = $(
     6109                    '#notifications-invite-users-content input[id^="recipient-"]'
     6110                );
     6111
     6112                inputs.on( 'keyup', function() {
     6113                    var empty = false;
     6114                    inputs.each( function() {
     6115                        if ( '' === $( this ).val() ) {
     6116                            empty = true;
     6117                        }
     6118                    } );
     6119
     6120                    if ( empty ) {
     6121                        $( '#add-recipient-button' ).attr( 'disabled', 'disabled' );
     6122                    } else {
     6123                        $( '#add-recipient-button' ).attr( 'disabled', false );
     6124                    }
     6125                } );
     6126            },
     6127
     6128            inputTabs: function( e ) {
     6129
     6130                var label  = this.$( e.target ),
     6131                    input   = label.find('input'),
     6132                    $data   = input.data( 'tab-menu' ),
     6133                    wrapper = label.closest( '.sui-side-tabs' ),
     6134                    list    = label.closest('.sui-tabs-menu').find( '.sui-tab-item' );
     6135
     6136                if ( label.is( 'label' ) ) {
     6137
     6138                    // Reset lists
     6139                    list.removeClass( 'active' );
     6140
     6141                    // Reset panes
     6142                    if ( wrapper.find( '.sui-tabs-content div[data-tab-content="' + $data + '"]' ).length ) {
     6143                        wrapper.find( '.sui-tabs-content div[data-tab-content="' + $data + '"]' ).attr( 'hidden', true );
     6144                        wrapper.find( '.sui-tabs-content div[data-tab-content="' + $data + '"]' ).removeClass( 'active' );
     6145                    }
     6146
     6147                    label.addClass( 'active' );
     6148
     6149                    // Select current content
     6150                    wrapper.find( '#' + input.attr( 'aria-controls' ) ).addClass( 'active' );
     6151                    wrapper.find( '#' + input.attr( 'aria-controls' ) ).attr( 'hidden', false );
     6152                    wrapper.find( '#' + input.attr( 'aria-controls' ) ).removeAttr( 'hidden' );
     6153                }
     6154
     6155                e.preventDefault();
     6156
     6157            },
     6158
     6159            load_users: function () {
     6160                var self = this;
     6161                $.ajax({
     6162                    url: Forminator.Data.ajaxUrl,
     6163                    type: "POST",
     6164                    data: {
     6165                        'action': 'forminator_search_users',
     6166                        'nonce': forminatorl10n.popup.fetch_nonce,
     6167                        'exclude': this.notification.exclude
     6168                    },
     6169                    success: function( response ) {
     6170                        if ( 'undefined' === typeof response.data ) {
     6171                            return;
     6172                        }
     6173
     6174                        var i = 0;
     6175                        response.data.forEach( function( user ) {
     6176                            self.addToUsersList( user, 0 === i++ );
     6177                        } );
     6178
     6179                        // Fix overflow for user selectors.
     6180                        self.fixRecipientCSS( $( '#forminator-user-list' ) );
     6181                    },
     6182                });
     6183            },
     6184
     6185            addToUsersList: function ( user, first ) {
     6186                const recipientList = $( '#forminator-user-list' );
     6187                const tooltipClass = first
     6188                    ? 'sui-tooltip-bottom-right'
     6189                    : 'sui-tooltip-top-right';
     6190                var row = '<div class="sui-recipient sui-recipient-rounded" data-id="' + user.id + '" data-email="' + user.email + '">' +
     6191                        '<span class="sui-recipient-name">' +
     6192                            '<span class="subscriber"><img alt="" src="' + user.avatar + '" alt="' + user.email + '"></span>' +
     6193                            '<span class="forminator-recipient-name">' + user.name + '</span>' +
     6194                        '</span>' +
     6195                        '<span class="sui-recipient-email">' + user.role + '</span>' +
     6196                        '<button type="button" class="sui-button-icon forminator-add-recipient sui-tooltip ' + tooltipClass + '" ' +
     6197                            'data-tooltip="' + forminatorl10n.popup.add_user + '"';
     6198                            row += "data-user='" + JSON.stringify( user ) + "'>";
     6199                            row += '<span class="sui-icon-plus" aria-hidden="true"></span>' +
     6200                        '</button>' +
     6201                    '</div>';
     6202                recipientList.append( row );
     6203                this.toggleRecipientList( recipientList, true );
     6204            },
     6205
     6206            toggleRecipientList: function ( el, userNotice ) {
     6207                if ( undefined === el.html() ) {
     6208                    return;
     6209                }
     6210                const hasItems = 0 === el.html().trim().length;
     6211
     6212                el.parent( 'div' )
     6213                    .toggleClass( 'sui-hidden', hasItems )
     6214                    .toggleClass( 'sui-margin-top', ! hasItems );
     6215
     6216                if ( userNotice ) {
     6217                    this.toggleUserNotice( false );
     6218                }
     6219            },
     6220
     6221            toggleUserNotice: function ( recipientExists ) {
     6222                const notice = $( '.notifications-recipients-notice' );
     6223                const btn = $( '#forminator-popup .sui-button.sui-button-blue' );
     6224                const saveButton = $( '.forminator-report-save' );
     6225
     6226                var text = forminatorl10n.popup.no_recipients;
     6227                if ( recipientExists ) {
     6228                    text = forminatorl10n.popup.recipient_exists;
     6229                } else if ( 0 !== this.notification.report_id ) {
     6230                    text = forminatorl10n.popup.no_recipient_disable;
     6231                }
     6232
     6233                notice.find( 'p' ).html( text );
     6234                if ( recipientExists ) {
     6235                    notice.removeClass( 'sui-hidden' );
     6236                    setTimeout( function() {
     6237                        notice.addClass( 'sui-hidden' );
     6238                    }, 3000);
     6239                } else if ( 0 === this.notification.recipients.length ) {
     6240                    btn.attr( 'disabled', 'disabled' );
     6241                    saveButton.attr( 'disabled', 'disabled' );
     6242                    notice.removeClass( 'sui-hidden' );
     6243                } else {
     6244                    btn.attr( 'disabled', false );
     6245                    saveButton.attr( 'disabled', false );
     6246                    notice.addClass( 'sui-hidden' );
     6247                }
     6248            },
     6249
     6250            fixRecipientCSS: function ( list ) {
     6251                const val = list.children().length > 1 ? 'hidden' : 'unset';
     6252                list.css( 'overflow-x', val );
     6253
     6254                list.find( '.sui-recipient:first-of-type .sui-tooltip' )
     6255                    .removeClass( 'sui-tooltip-top-right' )
     6256                    .addClass( 'sui-tooltip-bottom-right' );
     6257            },
     6258
     6259            add_recipient: function ( e, user ) {
     6260                e.preventDefault();
     6261                if ( '' === user || undefined === user ) {
     6262                    user = $( e.currentTarget ).data( 'user' );
     6263                }
     6264                if ( 'object' !== jQuery.type( user ) ) {
     6265                    return;
     6266                }
     6267
     6268                this.addUser( user, 'user' );
     6269
     6270                const recipientList = $( '#forminator-user-list' );
     6271                const el = '.sui-recipient[data-email="' + user.email + '"]';
     6272
     6273                // Remove Div.
     6274                recipientList.find( el ).remove();
     6275
     6276                this.fixRecipientCSS( recipientList );
     6277                this.toggleRecipientList( recipientList, false );
     6278            },
     6279
     6280            addUser: function( user, type ) {
     6281                // Check if recipient already exists.
     6282                const index = this.notification.recipients.findIndex(function(r) {
     6283                    return user.email === r.email
     6284                });
     6285                if ( index > -1 ) {
     6286                    this.toggleUserNotice( true );
     6287                    return;
     6288                }
     6289
     6290                const recipientList = $( '#modal-' + type + '-recipients-list' );
     6291                const role = '' === user.role ? user.email : user.role;
     6292
     6293                var subClass = '';
     6294                if ( 'undefined' !== typeof user.is_pending ) {
     6295                    if (
     6296                        ! user.is_pending &&
     6297                        'undefined' !== typeof user.is_subscribed &&
     6298                        ! user.is_subscribed
     6299                    ) {
     6300                        subClass = 'unsubscribed';
     6301                    } else {
     6302                        subClass = user.is_pending ? 'pending' : 'confirmed';
     6303                    }
     6304                }
     6305
     6306                var img = '<img src="' + user.avatar + '" alt="' + user.email + '">';
     6307                var confirmBtn = '';
     6308                if ( 'pending' === subClass || 'unsubscribed' === subClass ) {
     6309                    img = '<span class="sui-tooltip" data-tooltip="' + forminatorl10n.popup.awaiting_confirmation +'">' + img + '</span>';
     6310                    confirmBtn = '<button type="button" class="resend-invite sui-button-icon sui-tooltip" data-tooltip="' + forminatorl10n.popup.resend_invite + '">' +
     6311                        '<span class="sui-icon-send" aria-hidden="true"></span>' +
     6312                    '</button>';
     6313                }
     6314
     6315                const row = '<div class="sui-recipient sui-recipient-rounded" data-id="' + user.id + '" data-email="' + user.email + '">' +
     6316                        '<span class="sui-recipient-name">' +
     6317                            '<span class="subscriber ' + subClass + '">' + img + '</span>' +
     6318                            '<span class="forminator-recipient-name">' + user.name + '</span>' +
     6319                        '</span>' +
     6320                        '<span class="sui-recipient-email">' + role + '</span>' + confirmBtn + '' +
     6321                        '<button type="button" class="sui-button-icon forminator-remove-recipient sui-tooltip" ' +
     6322                            'data-tooltip="' + forminatorl10n.popup.remove_user + '" ' +
     6323                            'data-id="' + user.id + '" ' +
     6324                            'data-email="' + user.email + '"' +
     6325                            'data-type="' + type + '">' +
     6326                            '<span class="sui-icon-trash" aria-hidden="true"></span>' +
     6327                        '</button>' +
     6328                    '</div>';
     6329
     6330                recipientList.append( row );
     6331                // Add to the recipients and exclude arrays.
     6332                this.notification.recipients.push( user );
     6333                if ( 'user' === type ) {
     6334                    this.notification.exclude.push( user.id );
     6335                }
     6336
     6337                this.toggleRecipientList( recipientList, true );
     6338            },
     6339
     6340            remove_recipient: function ( e ) {
     6341                e.preventDefault();
     6342                const id = $( e.currentTarget ).data( 'id' ),
     6343                    email = $( e.currentTarget ).data( 'email' ),
     6344                    type = $( e.currentTarget ).data( 'type' ),
     6345                    recipientList = $( '#modal-' + type + '-recipients-list' ),
     6346                    el = '.sui-recipient[data-email="' + email + '"]';
     6347
     6348                // Remove Div.
     6349                const row = recipientList.find( el );
     6350                row.remove();
     6351
     6352                // Remove from exclude list.
     6353                var index;
     6354                if ( 'user' === type ) {
     6355                    index = this.notification.exclude.indexOf( id.toString() );
     6356                    if ( index > -1 ) {
     6357                        this.notification.exclude.splice( index, 1 );
     6358                    }
     6359                    this.returnToList( row );
     6360                }
     6361
     6362                // Remove from recipients array.
     6363                index = this.notification.recipients.findIndex(function(r) {
     6364                    return id === parseInt(r.id) && email === r.email
     6365                });
     6366                if ( index > -1 ) {
     6367                    this.notification.recipients.splice( index, 1 );
     6368                }
     6369
     6370                // Hide title if no more elements.
     6371                this.toggleRecipientList( recipientList, true );
     6372            },
     6373
     6374            returnToList: function ( el ) {
     6375                const recipientList = $( '#forminator-user-list' );
     6376
     6377                const user = {
     6378                    id: el.data( 'id' ),
     6379                    name: el.find( '.forminator-recipient-name' ).text(),
     6380                    email: el.data( 'email' ),
     6381                    role: el.find( '.sui-recipient-email' ).text(),
     6382                    avatar: el.find( 'img' ).attr( 'src' ),
     6383                };
     6384
     6385                // Remove the resend icon.
     6386                el.find( '.resend-invite' ).remove();
     6387
     6388                el.find( '.sui-icon-trash' )
     6389                    .removeClass( 'sui-icon-trash' )
     6390                    .addClass( 'sui-icon-plus' );
     6391
     6392                el.find( 'button' )
     6393                    .removeClass('forminator-remove-recipient')
     6394                    .attr( 'data-user', JSON.stringify( user ) )
     6395                    .attr( 'data-tooltip', forminatorl10n.popup.add_recipient )
     6396                    .addClass( 'forminator-add-recipient sui-tooltip-top-right' );
     6397
     6398                recipientList.append( el );
     6399
     6400                this.fixRecipientCSS( recipientList );
     6401                this.toggleRecipientList( recipientList, false );
     6402            },
     6403
     6404            initUserSelects: function () {
     6405                const userSelect = $( '#forminator-search-users' );
     6406                const self = this;
     6407                userSelect.SUIselect2( {
     6408                    minimumInputLength: 3,
     6409                    maximumSelectionLength: 1,
     6410                    ajax: {
     6411                        url: ajaxurl,
     6412                        type: 'POST',
     6413                        dataType: 'json',
     6414                        delay: 250,
     6415                        data: function ( params ) {
     6416                            return {
     6417                                action: 'forminator_search_users',
     6418                                nonce: forminatorl10n.popup.fetch_nonce,
     6419                                query: params.term,
     6420                                exclude: self.notification.exclude,
     6421                            };
     6422                        },
     6423                        processResults: function ( data ) {
     6424                            return {
     6425                                results: jQuery.map(
     6426                                    data.data,
     6427                                    function( item, index ) {
     6428                                        return {
     6429                                            text: item.name,
     6430                                            id: index,
     6431                                            user: {
     6432                                                name: item.name,
     6433                                                email: item.email,
     6434                                                role: item.role,
     6435                                                avatar: item.avatar,
     6436                                                id: item.id,
     6437                                            },
     6438                                        };
     6439                                    }
     6440                                ),
     6441                            };
     6442                        },
     6443                    },
     6444                } );
     6445                userSelect.on( 'select2:select', function( e ) {
     6446                    self.add_recipient( e, e.params.data.user );
     6447                    userSelect.val( null ).trigger( 'change' );
     6448                } );
     6449            },
     6450
     6451            invite_add_recipient: function () {
     6452                const btn = event.target;
     6453                var self = this;
     6454                btn.classList.add( 'sui-button-onload-text' );
     6455
     6456                const name = $( 'input#recipient-name' ),
     6457                    email = $( 'input#recipient-email' ),
     6458                    err = $( '#error-recipient-email' );
     6459
     6460                $.ajax({
     6461                    url: Forminator.Data.ajaxUrl,
     6462                    type: "POST",
     6463                    data: {
     6464                        'action': 'forminator_get_avatar',
     6465                        'nonce': forminatorl10n.popup.fetch_nonce,
     6466                        'email': email.val()
     6467                    },
     6468                    success: function( response ) {
     6469                        if ( 'undefined' === typeof response.data ) {
     6470                            return;
     6471                        }
     6472
     6473                        err.parents().removeClass( 'sui-form-field-error' );
     6474                        err.html('');
     6475
     6476                        if ( ! response.success ) {
     6477                            err.html( response.data.message );
     6478                            err.parents().addClass( 'sui-form-field-error' );
     6479                            btn.classList.remove( 'sui-button-onload-text' );
     6480
     6481                            return;
     6482                        }
     6483                        const user = {
     6484                            name: Forminator.Utils.sanitize_text_field( name.val() ),
     6485                            email: email.val(),
     6486                            role: '',
     6487                            avatar: response.data,
     6488                            id: 0,
     6489                        };
     6490
     6491                        self.addUser( user, 'email' );
     6492
     6493                        // Reset inputs.
     6494                        name.val( '' ).trigger( 'keyup' );
     6495                        email.val( '' ).trigger( 'keyup' );
     6496                        btn.classList.remove( 'sui-button-onload-text' );
     6497                    },
     6498                });
     6499            },
     6500
     6501            process_settings: function () {
     6502                this.notification.settings = {
     6503                    label: $( 'input#report-title' ).val(),
     6504                    module: $( 'label.active input[name="module"]' ).val(),
     6505                    forms_type: $( 'label.active input[name="forms_type"]' ).val(),
     6506                    selected_forms: $( 'select[name="select_forms"]' ).val(),
     6507                    quizzes_type: $( 'label.active input[name="quizzes_type"]' ).val(),
     6508                    selected_quizzes: $( 'select[name="select_quizzes"]' ).val(),
     6509                    polls_type: $( 'label.active input[name="polls_type"]' ).val(),
     6510                    selected_polls: $( 'select[name="select_polls"]' ).val(),
     6511                };
     6512            },
     6513
     6514            process_schedule : function () {
     6515                this.notification.schedule = {
     6516                    frequency: $( 'label.active input[name="frequency"]' ).val(),
     6517                    time: $( 'select[name="report-time"]' ).val(),
     6518                    weekDay: $( 'select[name="week-days"]' ).val(),
     6519                    weekTime: $( 'select[name="week-time"]' ).val(),
     6520                    monthDay: $( 'select[name="month-days"]' ).val(),
     6521                    monthTime: $( 'select[name="month-time"]' ).val(),
     6522                    yearMonth: $( 'select[name="year-month"]' ).val(),
     6523                    yearDays: $( 'select[name="year-days"]' ).val(),
     6524                    yearTime: $( 'select[name="year-time"]' ).val(),
     6525                }
     6526            },
     6527
     6528            report_save: function ( e ) {
     6529                e.preventDefault();
     6530                const report_id = $( e.currentTarget ).data( 'id' );
     6531                this.process_settings();
     6532                this.process_schedule();
     6533                if ( 0 !== this.notification.recipients.length ) {
     6534                    this.save(this.notification, report_id);
     6535                }
     6536            },
     6537
     6538            save: function ( reports, report_id ) {
     6539                var status = $('input.notification-save-status').is(':checked');
     6540                $.ajax({
     6541                    url: Forminator.Data.ajaxUrl,
     6542                    type: "POST",
     6543                    data: {
     6544                        'action': 'forminator_save_report',
     6545                        'nonce': forminatorl10n.popup.save_nonce,
     6546                        'report_id': report_id,
     6547                        'reports': reports,
     6548                        'status': status ? 'active' : 'inactive'
     6549                    },
     6550                    success: function( response ) {
     6551                        if ( response.success ) {
     6552                            location.reload();
     6553                        }
     6554                    },
     6555                });
     6556            },
     6557
     6558            fetch_report_data: function ( report_id ) {
     6559                const self = this;
     6560                $.ajax({
     6561                    url: Forminator.Data.ajaxUrl,
     6562                    type: "POST",
     6563                    data: {
     6564                        'action': 'forminator_fetch_report',
     6565                        'nonce': forminatorl10n.popup.fetch_nonce,
     6566                        'report_id': report_id,
     6567                    },
     6568                    success: function( response ) {
     6569                        if ( response.success && 'undefined' !== typeof response.data ) {
     6570                            self.notification = response.data
     6571                            self.load_users();
     6572                            self.$el.html( self.reportEditPopup({
     6573                                notification: self.notification
     6574                            }) );
     6575                            self.render_html();
     6576                        }
     6577                    },
     6578                }).always(function () {
     6579                    self.$el.find(".fui-loading-dialog").remove();
     6580                });
     6581            },
     6582        });
     6583    });
     6584})(jQuery);
     6585
     6586(function ($) {
     6587    formintorjs.define('admin/popups',[
     6588        'admin/popup/templates',
     6589        'admin/popup/login',
     6590        'admin/popup/quizzes',
     6591        'admin/popup/schedule',
     6592        'admin/popup/new-form',
     6593        'admin/popup/polls',
     6594        'admin/popup/ajax',
     6595        'admin/popup/delete',
     6596        'admin/popup/preview',
     6597        'admin/popup/reset-plugin-settings',
     6598        'admin/popup/disconnect-stripe',
     6599        'admin/popup/disconnect-paypal',
     6600        'admin/popup/approve-user',
     6601        'admin/popup/delete-unconfirmed-user',
     6602        'admin/popup/create-appearance-preset',
     6603        'admin/popup/apply-appearance-preset',
     6604        'admin/popup/confirm',
     6605        'admin/popup/addons-actions',
     6606        'admin/popup/reports-notification'
     6607    ], function(
     6608        TemplatesPopup,
     6609        LoginPopup,
     6610        QuizzesPopup,
     6611        SchedulePopup,
     6612        NewFormPopup,
     6613        PollsPopup,
     6614        AjaxPopup,
     6615        DeletePopup,
     6616        PreviewPopup,
     6617        ResetPluginSettingsPopup,
     6618        DisconnectStripePopup,
     6619        DisconnectPaypalPopup,
     6620        ApproveUserPopup,
     6621        DeleteUnconfirmedPopup,
     6622        CreateAppearancePresetPopup,
     6623        ApplyAppearancePresetPopup,
     6624        confirmationPopup,
     6625        AddonsActions,
     6626        ReportNotificationsPopup
     6627    ) {
     6628        var Popups = Backbone.View.extend({
     6629            el: 'main.sui-wrap',
     6630
     6631            events: {
     6632                "click .wpmudev-open-modal": "open_modal",
     6633                "click .wpmudev-button-open-modal": "open_modal"
     6634            },
     6635
     6636            initialize: function () {
     6637                var new_form = Forminator.Utils.get_url_param( 'new' ),
     6638                    form_title = Forminator.Utils.get_url_param( 'title' )
     6639                ;
     6640
     6641                if( new_form ) {
     6642                    var newForm = new NewFormPopup({
     6643                        title: form_title
     6644                    });
     6645                    newForm.render();
     6646
     6647                    this.open_popup( newForm, Forminator.l10n.popup.congratulations );
     6648                }
     6649
     6650                this.open_export();
     6651                this.open_delete();
     6652
     6653                this.maybeShowNotice();
     6654
     6655                return this.render();
     6656            },
     6657
     6658            render: function() {
     6659                return this;
     6660            },
     6661
     6662            maybeShowNotice: function() {
     6663                var notices = Forminator.l10n.notices;
     6664                if ( notices ) {
     6665                    $.each(notices, function(i, message) {
     6666                        var delay = 4000;
     6667                        if ( 'custom_notice' === i ) {
     6668                            delay = undefined;
     6669                        }
     6670                        Forminator.Notification.open( 'success', message, delay );
     6671                    });
     6672                }
     6673            },
     6674
     6675            open_delete: function() {
     6676                var has_delete = Forminator.Utils.get_url_param( 'delete' ),
     6677                    id = Forminator.Utils.get_url_param( 'module_id' ),
     6678                    nonce = Forminator.Utils.get_url_param( 'nonce' ),
     6679                    type = Forminator.Utils.get_url_param( 'module_type'),
     6680                    title = Forminator.l10n.popup.delete_form,
     6681                    desc = Forminator.l10n.popup.are_you_sure_form,
     6682                    self = this
     6683                ;
     6684
     6685                if ( type === 'poll' ) {
     6686                    title = Forminator.l10n.popup.delete_poll;
     6687                    desc = Forminator.l10n.popup.are_you_sure_poll;
     6688                }
     6689
     6690                if ( type === 'quiz' ) {
     6691                    title = Forminator.l10n.popup.delete_quiz;
     6692                    desc = Forminator.l10n.popup.are_you_sure_quiz;
     6693                }
     6694
     6695                if ( has_delete ) {
     6696                    setTimeout( function() {
     6697                        self.open_delete_popup( '', id, nonce, title, desc );
     6698                    }, 100 );
     6699                }
     6700            },
     6701
     6702            open_export: function() {
     6703                var has_export = Forminator.Utils.get_url_param( 'export' ),
     6704                    id = Forminator.Utils.get_url_param( 'module_id' ),
     6705                    nonce = Forminator.Utils.get_url_param( 'exportnonce' ),
     6706                    type = Forminator.Utils.get_url_param( 'module_type'),
     6707                    self = this
     6708                ;
     6709
     6710                if ( has_export ) {
     6711                    setTimeout( function() {
     6712                        self.open_export_module_modal( type, nonce, id, Forminator.l10n.popup.export_form, false, true, 'wpmudev-ajax-popup' );
     6713                    }, 100 );
     6714                }
     6715            },
     6716
     6717            open_modal: function( e ) {
     6718                e.preventDefault();
     6719
     6720                var $target = $( e.target ),
     6721                    $container = $( e.target ).closest( '.wpmudev-split--item' );
     6722
     6723                if( ! $target.hasClass( 'wpmudev-open-modal' ) && ! $target.hasClass( 'wpmudev-button-open-modal' ) ) {
     6724                    $target = $target.closest( '.wpmudev-open-modal,.wpmudev-button-open-modal' );
     6725                }
     6726
     6727                var $module = $target.data( 'modal' ),
     6728                    nonce = $target.data( 'nonce' ),
     6729                    id = $target.data( 'form-id' ),
     6730                    action = $target.data( 'action' ),
     6731                    has_leads = $target.data( 'has-leads' ),
     6732                    leads_id = $target.data( 'leads-id' ),
     6733                    title = $target.data( 'modal-title' ),
     6734                    content = $target.data('modal-content'),
     6735                    button = $target.data('button-text'),
     6736                    preview_nonce = $target.data('nonce-preview')
     6737                ;
     6738
     6739                // Open appropriate popup
     6740                switch ( $module ) {
     6741                    case 'custom_forms':
     6742                        this.open_cform_popup();
     6743                        break;
     6744                    case 'login_registration_forms':
     6745                        this.open_login_popup();
     6746                        break;
     6747                    case 'polls':
     6748                        this.open_polls_popup();
     6749                        break;
     6750                    case 'quizzes':
     6751                        this.open_quizzes_popup();
     6752                        break;
     6753                    case 'exports':
     6754                        this.open_settings_modal( $module, nonce, id, Forminator.l10n.popup.your_exports );
     6755                        break;
     6756                    case 'exports-schedule':
     6757                        this.open_exports_schedule_popup();
     6758                        break;
     6759                    case 'delete-module':
     6760                        this.open_delete_popup( '', id, nonce, title, content, action, button );
     6761                        break;
     6762                    case 'delete-poll-submission':
     6763                        this.open_delete_popup( 'poll', id, nonce, title, content );
     6764                        break;
     6765                    case 'paypal':
     6766                        this.open_settings_modal( $module, nonce, id, Forminator.l10n.popup.paypal_settings );
     6767                        break;
     6768                    case 'preview_cforms':
     6769                        if (_.isUndefined(title)) {
     6770                            title = Forminator.l10n.popup.preview_cforms
     6771                        }
     6772                        this.open_preview_popup( id, title, 'forminator_load_form', 'forminator_forms', preview_nonce );
     6773                        break;
     6774                    case 'preview_polls':
     6775                        if (_.isUndefined(title)) {
     6776                            title = Forminator.l10n.popup.preview_polls
     6777                        }
     6778                        this.open_preview_popup( id, title, 'forminator_load_poll', 'forminator_polls', preview_nonce );
     6779                        break;
     6780                    case 'preview_quizzes':
     6781                        if (_.isUndefined(title)) {
     6782                            title = Forminator.l10n.popup.preview_quizzes
     6783                        }
     6784                        this.open_quiz_preview_popup( id, title, 'forminator_load_quiz', 'forminator_quizzes', has_leads, leads_id, preview_nonce );
     6785                        break;
     6786                    case 'captcha':
     6787                        this.open_settings_modal( $module, nonce, id, Forminator.l10n.popup.captcha_settings, false, true, 'wpmudev-ajax-popup' );
     6788                        break;
     6789                    case 'currency':
     6790                        this.open_settings_modal( $module, nonce, id, Forminator.l10n.popup.currency_settings, false, true, 'wpmudev-ajax-popup' );
     6791                        break;
     6792                    case 'pagination_entries':
     6793                        this.open_settings_modal( $module, nonce, id, Forminator.l10n.popup.pagination_entries, false, true, 'wpmudev-ajax-popup' );
     6794                        break;
     6795                    case 'pagination_listings':
     6796                        this.open_settings_modal( $module, nonce, id, Forminator.l10n.popup.pagination_listings, false, true, 'wpmudev-ajax-popup' );
     6797                        break;
     6798                    case 'email_settings':
     6799                        this.open_settings_modal( $module, nonce, id, Forminator.l10n.popup.email_settings, false, true, 'wpmudev-ajax-popup' );
     6800                        break;
     6801                    case 'uninstall_settings':
     6802                        this.open_settings_modal( $module, nonce, id, Forminator.l10n.popup.uninstall_settings, false, true, 'wpmudev-ajax-popup' );
     6803                        break;
     6804                    case 'privacy_settings':
     6805                        this.open_settings_modal( $module, nonce, id, Forminator.l10n.popup.privacy_settings, false, true, 'wpmudev-ajax-popup' );
     6806                        break;
     6807                    case 'create_preset':
     6808                        this.create_appearance_preset_modal( nonce, title, content, $target );
     6809                        break;
     6810                    case 'apply_preset':
     6811                        this.apply_appearance_preset_modal( $target );
     6812                        break;
     6813                    case 'delete_preset':
     6814                        this.delete_preset_modal( title, content );
     6815                        break;
     6816                    case 'export_form':
     6817                        this.open_export_module_modal( 'form', nonce, id, Forminator.l10n.popup.export_form, false, true, 'wpmudev-ajax-popup' );
     6818                        break;
     6819                    case 'export_poll':
     6820                        this.open_export_module_modal( 'poll', nonce, id, Forminator.l10n.popup.export_poll, false, true, 'wpmudev-ajax-popup' );
     6821                        break;
     6822                    case 'export_quiz':
     6823                        this.open_export_module_modal( 'quiz', nonce, id, Forminator.l10n.popup.export_quiz, false, true, 'wpmudev-ajax-popup' );
     6824                        break;
     6825                    case 'import_form':
     6826                        this.open_import_module_modal( 'form', nonce, id, Forminator.l10n.popup.import_form, false, true, 'wpmudev-ajax-popup' );
     6827                        break;
     6828                    case 'import_form_cf7':
     6829                        this.open_import_module_modal( 'form_cf7', nonce, id, Forminator.l10n.popup.import_form_cf7, false, true, 'wpmudev-ajax-popup' );
     6830                        break;
     6831                    case 'import_form_ninja':
     6832                        this.open_import_module_modal( 'form_ninja', nonce, id, Forminator.l10n.popup.import_form_ninja, false, true, 'wpmudev-ajax-popup' );
     6833                        break;
     6834                    case 'import_form_gravity':
     6835                        this.open_import_module_modal( 'form_gravity', nonce, id, Forminator.l10n.popup.import_form_gravity, false, true, 'wpmudev-ajax-popup' );
     6836                        break;
     6837                    case 'import_poll':
     6838                        this.open_import_module_modal( 'poll', nonce, id, Forminator.l10n.popup.import_poll, false, true, 'wpmudev-ajax-popup' );
     6839                        break;
     6840                    case 'import_quiz':
     6841                        this.open_import_module_modal( 'quiz', nonce, id, Forminator.l10n.popup.import_quiz, false, true, 'wpmudev-ajax-popup' );
     6842                        break;
     6843                    case 'reset-plugin-settings':
     6844                        this.open_reset_plugin_settings_popup( nonce, title, content );
     6845                        break;
     6846                    case 'disconnect-stripe':
     6847                        this.open_disconnect_stripe_popup( nonce, title, content );
     6848                        break;
     6849                    case 'disconnect-paypal':
     6850                        this.open_disconnect_paypal_popup( nonce, title, content );
     6851                        break;
     6852                    case 'approve-user-module':
     6853                        var activationKey = $target.data('activation-key');
     6854                        this.open_approve_user_popup( nonce, title, content, activationKey );
     6855                        break;
     6856                    case 'delete-unconfirmed-user-module':
     6857                        this.open_unconfirmed_user_popup( $target.data( 'form-id' ), nonce, title, content, $target.data('activation-key'), $target.data( 'entry-id' ) );
     6858                        break;
     6859                    case 'addons_page_details':
     6860                        this.open_addons_page_modal( $module, nonce, id, title, false, true, 'wpmudev-ajax-popup' );
     6861                        break;
     6862                    case 'addons_page_install':
     6863                        this.open_addons_page_install( $module, nonce, id, title, false, true, 'wpmudev-ajax-popup' );
     6864                        break;
     6865                    case 'addons-deactivate':
     6866                        this.open_addons_actions_popup( $module, $target.data( 'addon' ), nonce, title, content, $target.data( 'addon-slug' ), $target.data( 'is_network' ) );
     6867                        break;
     6868                    case 'configure-report':
     6869                        this.open_reports_notifications_popup( $target.data( 'id' ) );
     6870                        break;
     6871                    case 'delete-report':
     6872                        this.open_delete_popup( '', id, nonce, title, content, action, button );
     6873                        break;
     6874
     6875                }
     6876            },
     6877
     6878            open_popup: function ( view, title, has_custom_box, action_text, action_css_class, action_callback, rendered_call_back, modalSize, modalTitle ) {
     6879                if( _.isUndefined( title ) ) {
     6880                    title = Forminator.l10n.custom_form.popup_label;
     6881                }
     6882
     6883                var popup_options = {
     6884                    title: title
     6885                };
     6886                if (!_.isUndefined(has_custom_box)) {
     6887                    popup_options.has_custom_box = has_custom_box;
     6888                }
     6889                if (!_.isUndefined(action_text)) {
     6890                    popup_options.action_text = action_text;
     6891                }
     6892                if (!_.isUndefined(action_css_class)) {
     6893                    popup_options.action_css_class = action_css_class;
     6894                }
     6895                if (!_.isUndefined(action_callback)) {
     6896                    popup_options.action_callback = action_callback;
     6897                }
     6898
     6899                Forminator.Popup.open( function () {
     6900                    // If not a view append directly
     6901                    if( ! _.isUndefined( view.el ) ) {
     6902                        $( this ).append( view.el );
     6903                    } else {
     6904                        $( this ).append( view );
     6905                    }
     6906
     6907                    if (typeof rendered_call_back === 'function') {
     6908                        rendered_call_back.apply(this);
     6909                    }
     6910                }, popup_options, modalSize, modalTitle );
     6911            },
     6912
     6913            open_ajax_popup: function( action, nonce, id, title, enable_loader, has_custom_box, ajax_div_class_name, modalSize, modalTitle) {
     6914                if( _.isUndefined( title ) ) {
     6915                    title = Forminator.l10n.custom_form.popup_label;
     6916                }
     6917                if( _.isUndefined( enable_loader ) ) {
     6918                    enable_loader = true;
     6919                }
     6920                if( _.isUndefined( has_custom_box ) ) {
     6921                    has_custom_box = false;
     6922                }
     6923
     6924                if( _.isUndefined( ajax_div_class_name ) ) {
     6925                    ajax_div_class_name = 'sui-box-body';
     6926                }
     6927
     6928                var view = new AjaxPopup({
     6929                    action: action,
     6930                    nonce: nonce,
     6931                    id: id,
     6932                    enable_loader: true,
     6933                    className: ajax_div_class_name,
     6934                });
     6935
     6936                var popup_options = {
     6937                    title         : title,
     6938                    has_custom_box: has_custom_box
     6939                };
     6940
     6941                Forminator.Popup.open(function () {
     6942                    $(this).append(view.el);
     6943                }, popup_options, modalSize, modalTitle );
     6944            },
     6945
     6946            // MODAL: Delete.
     6947            open_delete_popup: function ( module, id, nonce, title, content, action, button) {
     6948                action = action || 'delete';
     6949                var newForm = new DeletePopup({
     6950                    module: module,
     6951                    id: id,
     6952                    action: action,
     6953                    nonce: nonce,
     6954                    referrer: window.location.pathname + window.location.search,
     6955                    button: Forminator.Utils.sanitize_text_field( button ),
     6956                    content: Forminator.Utils.sanitize_text_field( content )
     6957                });
     6958                newForm.render();
     6959
     6960                var view = newForm;
     6961
     6962                var popup_options = {
     6963                    title: title,
     6964                    has_custom_box: true
     6965                }
     6966
     6967                var modalSize = 'sm';
     6968
     6969                var modalTitle = 'center';
     6970
     6971                Forminator.Popup.open( function () {
     6972                    // If not a view append directly
     6973                    if( ! _.isUndefined( view.el ) ) {
     6974                        $( this ).append( view.el );
     6975                    } else {
     6976                        $( this ).append( view );
     6977                    }
     6978                }, popup_options, modalSize, modalTitle );
     6979            },
     6980
     6981            // MODAL: Create Form.
     6982            open_cform_popup: function () {
     6983                var newForm = new TemplatesPopup({
     6984                    type: 'form'
     6985                });
     6986                newForm.render();
     6987
     6988                var view = newForm;
     6989
     6990                var modalSize = 'lg';
     6991
     6992                var popup_options = {
     6993                    title: '',
     6994                    has_custom_box: true
     6995                };
     6996
     6997                Forminator.Popup.open( function () {
     6998                    // If not a view append directly
     6999                    if( ! _.isUndefined( view.el ) ) {
     7000                        $( this ).append( view.el );
     7001                    } else {
     7002                        $( this ).append( view );
     7003                    }
     7004                }, popup_options, modalSize );
     7005
     7006            },
     7007
     7008            // MODAL: Create Poll.
     7009            open_polls_popup: function() {
     7010                var newForm = new PollsPopup();
     7011                newForm.render();
     7012
     7013                var view = newForm;
     7014
     7015                var popup_options = {
     7016                    title: '',
     7017                    has_custom_box: true
     7018                };
     7019
     7020                var modalSize = 'sm';
     7021
     7022                Forminator.Popup.open( function() {
     7023                    // If not a view append directly
     7024                    if( ! _.isUndefined( view.el ) ) {
     7025                        $( this ).append( view.el );
     7026                    } else {
     7027                        $( this ).append( view );
     7028                    }
     7029                }, popup_options, modalSize );
     7030            },
     7031
     7032            // MODAL: Create Quiz.
     7033            open_quizzes_popup: function () {
     7034
     7035                var self = this,
     7036                    newForm = new QuizzesPopup();
     7037
     7038                newForm.render();
     7039
     7040                var view = newForm;
     7041
     7042                var popup_options = {
     7043                    title: Forminator.l10n.quiz.choose_quiz_title,
     7044                    has_custom_box: true
     7045                }
     7046
     7047                var modalSize = 'lg';
     7048
     7049                Forminator.Popup.open( function () {
     7050
     7051                    // If not a view append directly
     7052                    if( ! _.isUndefined( view.el ) ) {
     7053                        $( this ).append( view.el );
     7054                    } else {
     7055                        $( this ).append( view );
     7056                    }
     7057                }, popup_options, modalSize );
     7058
     7059                //this.open_popup( newForm, Forminator.l10n.quiz.choose_quiz_type, true );
     7060            },
     7061
     7062            // MODAL: Import.
     7063            open_import_module_modal: function(module, nonce, id, label, enable_loader, has_custom_box, ajax_div_class_name ) {
     7064                var action = '';
     7065                switch(module){
     7066                    case 'form':
     7067                    case 'form_cf7':
     7068                    case 'form_ninja':
     7069                    case 'form_gravity':
     7070                    case 'poll':
     7071                    case 'quiz':
     7072                        action = 'import_' + module;
     7073                        break;
     7074                }
     7075                this.open_ajax_popup(
     7076                    action,
     7077                    nonce,
     7078                    id,
     7079                    label,
     7080                    enable_loader,
     7081                    has_custom_box,
     7082                    ajax_div_class_name,
     7083                    'sm',
     7084                    'center'
     7085                );
     7086            },
     7087
     7088            // MODAL: Export (on Submissions page).
     7089            open_exports_schedule_popup: function () {
     7090                var newForm = new SchedulePopup();
     7091                newForm.render();
     7092
     7093                this.open_popup(
     7094                    newForm,
     7095                    Forminator.l10n.popup.edit_scheduled_export,
     7096                    true,
     7097                    undefined,
     7098                    undefined,
     7099                    undefined,
     7100                    undefined,
     7101                    'md',
     7102                    'inline'
     7103                );
     7104            },
     7105
     7106            // MODAL: Reset Plugin (on Settings page).
     7107            open_reset_plugin_settings_popup: function (nonce, title, content) {
     7108                var self = this,
     7109                    newForm = new ResetPluginSettingsPopup({
     7110                        nonce: nonce,
     7111                        referrer: window.location.pathname + window.location.search,
     7112                        content: content
     7113                    });
     7114                newForm.render();
     7115
     7116                var view = newForm;
     7117
     7118                var popup_options = {
     7119                    title: title,
     7120                    has_custom_box: true
     7121                }
     7122
     7123                var modalSize = 'sm';
     7124
     7125                var modalTitle = 'center';
     7126
     7127                Forminator.Popup.open( function () {
     7128                    // If not a view append directly
     7129                    if( ! _.isUndefined( view.el ) ) {
     7130                        $( this ).append( view.el );
     7131                    } else {
     7132                        $( this ).append( view );
     7133                    }
     7134                }, popup_options, modalSize, modalTitle );
     7135            },
     7136
     7137            // MODAL: Disconnect PayPal (on Settings page).
     7138            open_addons_actions_popup: function ( module, id, nonce, title, content, slug, is_network ) {
     7139                is_network = is_network || false;
     7140                var self = this,
     7141                    newForm = new AddonsActions({
     7142                        module: module,
     7143                        id: id,
     7144                        nonce: nonce,
     7145                        is_network: is_network,
     7146                        referrer: window.location.pathname + window.location.search,
     7147                        content: content,
     7148                        forms: 'stripe' === slug ? forminatorData.stripeForms : []
     7149                    });
     7150
     7151                newForm.render();
     7152                var view = newForm;
     7153
     7154                var popup_options = {
     7155                    title: title,
     7156                    has_custom_box: true
     7157                }
     7158
     7159                var modalSize = 'sm';
     7160
     7161                var modalTitle = 'center';
     7162
     7163                Forminator.Popup.open( function () {
     7164                    // If not a view append directly
     7165                    if( ! _.isUndefined( view.el ) ) {
     7166                        $( this ).append( view.el );
     7167                    } else {
     7168                        $( this ).append( view );
     7169                    }
     7170                }, popup_options, modalSize, modalTitle );
     7171            },
     7172
     7173            open_login_popup: function () {
     7174                var newForm = new LoginPopup();
     7175                newForm.render();
     7176
     7177                this.open_popup(
     7178                    newForm,
     7179                    Forminator.l10n.popup.edit_login_form,
     7180                    undefined,
     7181                    undefined,
     7182                    undefined,
     7183                    undefined,
     7184                    undefined,
     7185                    'md',
     7186                    'inline'
     7187                );
     7188            },
     7189
     7190            open_settings_modal: function ( type, nonce, id, label, enable_loader, has_custom_box, ajax_div_class_name ) {
     7191                this.open_ajax_popup(
     7192                    type,
     7193                    nonce,
     7194                    id,
     7195                    label,
     7196                    enable_loader,
     7197                    has_custom_box,
     7198                    ajax_div_class_name,
     7199                    'md',
     7200                    'inline'
     7201                );
     7202            },
     7203
     7204            open_addons_page_modal: function ( type, nonce, id, label, enable_loader, has_custom_box, ajax_div_class_name ) {
     7205                this.open_ajax_popup(
     7206                    type,
     7207                    nonce,
     7208                    id,
     7209                    label,
     7210                    enable_loader,
     7211                    has_custom_box,
     7212                    ajax_div_class_name,
     7213                    'md',
     7214                    'inline'
     7215                );
     7216            },
     7217
     7218            open_addons_page_install: function ( type, nonce, id, label, enable_loader, has_custom_box, ajax_div_class_name ) {
     7219                this.open_ajax_popup(
     7220                    type,
     7221                    nonce,
     7222                    id,
     7223                    label,
     7224                    enable_loader,
     7225                    has_custom_box,
     7226                    ajax_div_class_name,
     7227                    'lg',
     7228                    'inline'
     7229                );
     7230            },
     7231
     7232            open_export_module_modal: function(module, nonce, id, label, enable_loader, has_custom_box, ajax_div_class_name ) {
     7233                var action = '';
     7234                switch(module){
     7235                    case 'form':
     7236                    case 'poll':
     7237                    case 'quiz':
     7238                        action = 'export_' + module;
     7239                        break;
     7240                }
     7241                this.open_ajax_popup(
     7242                    action,
     7243                    nonce,
     7244                    id,
     7245                    label,
     7246                    enable_loader,
     7247                    has_custom_box,
     7248                    ajax_div_class_name,
     7249                    'md',
     7250                    'inline'
     7251                );
     7252            },
     7253
     7254            open_preview_popup: function( id, title, action, type, nonce ) {
     7255                if( _.isUndefined( title ) ) {
     7256                    title = Forminator.l10n.custom_form.popup_label;
     7257                }
     7258
     7259                var view = new PreviewPopup( {
     7260                    action: action,
     7261                    type: type,
     7262                    nonce: nonce,
     7263                    id: id,
     7264                    enable_loader: true,
     7265                    className: 'sui-box-body',
     7266                } );
     7267
     7268                var popup_options = {
     7269                    title         : title,
     7270                    has_custom_box: true
     7271                };
     7272
     7273                var modalSize = 'lg';
     7274
     7275                var modalTitle = 'inline';
     7276
     7277                Forminator.Popup.open( function () {
     7278                    $( this ).append( view.el );
     7279                }, popup_options, modalSize, modalTitle );
     7280            },
     7281
     7282            open_quiz_preview_popup: function( id, title, action, type, has_leads, leads_id, nonce ) {
     7283                if( _.isUndefined( title ) ) {
     7284                    title = Forminator.l10n.custom_form.popup_label;
     7285                }
     7286
     7287                var view = new PreviewPopup( {
     7288                    action: action,
     7289                    type: type,
     7290                    id: id,
     7291                    enable_loader: true,
     7292                    className: 'sui-box-body',
     7293                    has_lead: has_leads,
     7294                    leads_id: leads_id,
     7295                    nonce: nonce,
     7296                } );
     7297
     7298                var popup_options = {
     7299                    title         : title,
     7300                    has_custom_box: true
     7301                };
     7302
     7303                var modalSize = 'lg';
     7304
     7305                var modalTitle = 'inline';
     7306
     7307                Forminator.Popup.open(function () {
     7308                    $(this).append(view.el);
     7309
     7310                }, popup_options, modalSize, modalTitle );
     7311            },
     7312
     7313            apply_appearance_preset_modal: function ($target) {
     7314                var newForm = new ApplyAppearancePresetPopup({
     7315                    $target: $target
     7316                });
     7317                newForm.render();
     7318
     7319                var view = newForm;
     7320
     7321                Forminator.Popup.open( function () {
     7322                    $( this ).append( view.el );
     7323                }, {
     7324                    title: Forminator.Data.modules.ApplyPreset.title,
     7325                    has_custom_box: true,
     7326                }, 'sm', 'center' );
     7327            },
     7328
     7329            delete_preset_modal: function (title, content) {
     7330                var newForm = new confirmationPopup({
     7331                    confirmation_message: content,
     7332                    confirm_callback: function () {
     7333                        var deletePreset = new Event('deletePreset');
     7334                        window.dispatchEvent( deletePreset );
     7335                    },
     7336                });
     7337                newForm.render();
     7338
     7339                var view = newForm;
     7340
     7341                Forminator.Popup.open( function () {
     7342                    $( this ).append( view.el );
     7343                }, {
     7344                    title: title,
     7345                    has_custom_box: true,
     7346                }, 'sm', 'center' );
     7347            },
     7348
     7349            create_appearance_preset_modal: function (nonce, title, content, $target) {
     7350                var newForm = new CreateAppearancePresetPopup({
     7351                    nonce: nonce,
     7352                    $target: $target,
     7353                    title: title,
     7354                    content: content
     7355                });
     7356                newForm.render();
     7357
     7358                var view = newForm;
     7359
     7360                Forminator.Popup.open( function () {
     7361                    $( this ).append( view.el );
     7362                }, {
     7363                    title: title,
     7364                    has_custom_box: true,
     7365                }, 'sm', 'center' );
     7366            },
     7367
     7368            open_disconnect_stripe_popup: function (nonce, title, content) {
     7369                var self = this;
     7370                var newForm = new DisconnectStripePopup({
     7371                    nonce: nonce,
     7372                    referrer: window.location.pathname + window.location.search,
     7373                    content: content
     7374                });
     7375                newForm.render();
     7376
     7377                var view = newForm;
     7378
     7379                var popup_options = {
     7380                    title: title,
     7381                    has_custom_box: true
     7382                }
     7383
     7384                var modalSize = 'sm';
     7385
     7386                var modalTitle = 'center';
     7387
     7388                Forminator.Popup.open( function () {
     7389                    // If not a view append directly
     7390                    if( ! _.isUndefined( view.el ) ) {
     7391                        $( this ).append( view.el );
     7392                    } else {
     7393                        $( this ).append( view );
     7394                    }
     7395                }, popup_options, modalSize, modalTitle );
     7396            },
     7397
     7398            open_disconnect_paypal_popup: function (nonce, title, content) {
     7399                var self = this;
     7400                var newForm = new DisconnectPaypalPopup({
     7401                    nonce: nonce,
     7402                    referrer: window.location.pathname + window.location.search,
     7403                    content: content
     7404                });
     7405                newForm.render();
     7406
     7407                var view = newForm;
     7408
     7409                var popup_options = {
     7410                    title: title,
     7411                    has_custom_box: true
     7412                }
     7413
     7414                var modalSize = 'sm';
     7415
     7416                var modalTitle = 'center';
     7417
     7418                Forminator.Popup.open( function () {
     7419                    // If not a view append directly
     7420                    if( ! _.isUndefined( view.el ) ) {
     7421                        $( this ).append( view.el );
     7422                    } else {
     7423                        $( this ).append( view );
     7424                    }
     7425                }, popup_options, modalSize, modalTitle );
     7426            },
     7427
     7428            open_approve_user_popup: function (nonce, title, content, activationKey) {
     7429                var self = this;
     7430                var newForm = new ApproveUserPopup({
     7431                    nonce: nonce,
     7432                    referrer: window.location.pathname + window.location.search,
     7433                    content: content,
     7434                    activationKey: activationKey
     7435                });
     7436                newForm.render();
     7437
     7438                var view = newForm;
     7439
     7440                Forminator.Popup.open( function () {
     7441                    // If not a view append directly
     7442                    if( ! _.isUndefined( view.el ) ) {
     7443                        $( this ).append( view.el );
     7444                    } else {
     7445                        $( this ).append( view );
     7446                    }
     7447                }, {
     7448                    title: title,
     7449                    has_custom_box: true,
     7450                }, 'md', 'inline' );
     7451            },
     7452
     7453            open_unconfirmed_user_popup: function ( formId, nonce, title, content, activationKey, entryId ) {
     7454                var newForm = new DeleteUnconfirmedPopup({
     7455                    formId: formId,
     7456                    nonce: nonce,
     7457                    referrer: window.location.pathname + window.location.search,
     7458                    content: content,
     7459                    activationKey: activationKey,
     7460                    entryId: entryId
     7461                });
     7462                newForm.render();
     7463
     7464                var view = newForm;
     7465
     7466                Forminator.Popup.open( function () {
     7467                    // If not a view append directly
     7468                    if( ! _.isUndefined( view.el ) ) {
     7469                        $( this ).append( view.el );
     7470                    } else {
     7471                        $( this ).append( view );
     7472                    }
     7473                }, {
     7474                    title: title,
     7475                    has_custom_box: true,
     7476                }, 'md', 'inline');
     7477            },
     7478
     7479            open_reports_notifications_popup: function ( report_id ) {
     7480                var reports = new ReportNotificationsPopup({
     7481                    type: 'reports',
     7482                    report_id: report_id
     7483                });
     7484                reports.render();
     7485
     7486                var view = reports;
     7487
     7488                var modalSize = 'md';
     7489
     7490                var popup_options = {
     7491                    title: '',
     7492                    has_custom_box: true
     7493                };
     7494
     7495                if ( 0 !== report_id ) {
     7496                    Forminator.Popup.open( function () {
     7497                        // If not a view append directly
     7498                        if( ! _.isUndefined( view.el ) ) {
     7499                            $( this ).append( view.el );
     7500                        } else {
     7501                            $( this ).append( view );
     7502                        }
     7503                    }, popup_options, modalSize );
     7504                } else {
     7505                    Forminator.Slide_Popup.open( function () {
     7506                        // If not a view append directly
     7507                        if( ! _.isUndefined( view.el ) ) {
     7508                            $( this ).append( view.el );
     7509                        } else {
     7510                            $( this ).append( view );
     7511                        }
     7512                    }, popup_options, modalSize );
     7513                }
     7514            },
     7515        });
     7516
     7517        //init after jquery ready
     7518        jQuery( function() {
     7519            new Popups();
     7520        });
     7521    });
     7522})(jQuery);
     7523
     7524
     7525
     7526formintorjs.define('text!tpl/popups.html',[],function () { return '<div>\r\n\r\n\t<!-- Base Structure -->\r\n\t<script type="text/template" id="popup-tpl">\r\n\r\n\t\t<div class="sui-modal">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-popup__title"\r\n\t\t\t\taria-describedby="forminator-popup__description"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- Modal Header: Center-aligned title with floating close button -->\r\n\t<script type="text/template" id="popup-header-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title sui-lg">{{ title }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<!-- Modal Header: Inline title and close button -->\r\n\t<script type="text/template" id="popup-header-inline-tpl">\r\n\r\n\t\t<div class="sui-box-header">\r\n\r\n\t\t\t<h3 id="forminator-popup__title" class="sui-box-title">{{ title }}</h3>\r\n\r\n\t\t\t<div class="sui-actions-right">\r\n\r\n\t\t\t\t<button class="sui-button-icon forminator-popup-close" data-modal-close>\r\n\t\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t\t</button>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-integration-tpl">\r\n\r\n\t\t<div class="sui-modal sui-modal-sm">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-integration-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-integration-popup__title"\r\n\t\t\t\taria-describedby="forminator-integration-popup__description"\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-integration-content-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<figure class="sui-box-logo" aria-hidden="true">\r\n\r\n\t\t\t\t<img\r\n\t\t\t\t\tsrc="{{ image }}"\r\n\t\t\t\t\tsrcset="{{ image }} 1x, {{ image_x2 }} 2x"\r\n\t\t\t\t\talt="{{ title }}"\r\n\t\t\t\t/>\r\n\r\n\t\t\t</figure>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--left forminator-addon-back" style="display: none;">\r\n\t\t\t\t<span class="sui-icon-chevron-left sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Back</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-integration-close" data-modal-close>\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">Close</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<div class="forminator-integration-popup__header"></div>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="forminator-integration-popup__body sui-box-body"></div>\r\n\r\n\t\t<div class="forminator-integration-popup__footer sui-box-footer sui-flatten sui-content-separated"></div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-loader-tpl">\r\n\r\n\t\t<p style="margin: 0; text-align: center;" aria-hidden="true"><span class="sui-icon-loader sui-md sui-loading"></span></p>\r\n\t\t<p class="sui-screen-reader-text">Loading content...</p>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-stripe-tpl">\r\n\r\n\t\t<div class="sui-modal sui-modal-md">\r\n\r\n\t\t\t<div\r\n\t\t\t\trole="dialog"\r\n\t\t\t\tid="forminator-stripe-popup"\r\n\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\taria-modal="true"\r\n\t\t\t\taria-labelledby="forminator-stripe-popup__title"\r\n\t\t\t\taria-describedby=""\r\n\t\t\t>\r\n\r\n\t\t\t\t<div class="sui-box"></div>\r\n\r\n\t\t\t</div>\r\n\r\n\t\t</div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-stripe-content-tpl">\r\n\r\n\t\t<div class="sui-box-header sui-flatten sui-content-center sui-spacing-top--60">\r\n\r\n\t\t\t<figure class="sui-box-logo" aria-hidden="true">\r\n\t\t\t\t<img src="{{ image }}" srcset="{{ image }} 1x, {{ image_x2 }} 2x" alt="{{ title }}" />\r\n\t\t\t</figure>\r\n\r\n\t\t\t<button class="sui-button-icon sui-button-float--right forminator-popup-close">\r\n\t\t\t\t<span class="sui-icon-close sui-md" aria-hidden="true"></span>\r\n\t\t\t\t<span class="sui-screen-reader-text">{{ Forminator.l10n.popup.close_label }}</span>\r\n\t\t\t</button>\r\n\r\n\t\t\t<h3 id="forminator-stripe-popup__title" class="sui-box-title sui-lg" style="overflow: initial; display: none; white-space: normal; text-overflow: initial;">{{ title }}</h3>\r\n\r\n\t\t</div>\r\n\r\n\t\t<div class="sui-box-body sui-spacing-top--10"></div>\r\n\r\n\t\t<div class="sui-box-footer sui-flatten sui-content-center"></div>\r\n\r\n\t</script>\r\n\r\n\t<script type="text/template" id="popup-slide-tpl">\r\n\t\t<div class="sui-modal sui-modal-lg">\r\n\t\t\t<div\r\n\t\t\t\t\trole="dialog"\r\n\t\t\t\t\tid="forminator-popup"\r\n\t\t\t\t\tclass="sui-modal-content"\r\n\t\t\t\t\taria-modal="true"\r\n\t\t\t\t\taria-labelledby="forminator-slide-popup__title"\r\n\t\t\t\t\taria-describedby="forminator-slide-popup__description"\r\n\t\t\t>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</script>\r\n\r\n</div>\r\n';});
     7527
     7528(function ($) {
     7529    formintorjs.define('admin/addons/view',[
     7530        'text!tpl/popups.html'
     7531    ], function( popupsTpl ) {
     7532        return Backbone.View.extend({
     7533            className: 'wpmudev-section--integrations',
     7534
     7535            loaderTpl: Forminator.Utils.template( $( popupsTpl ).find( '#popup-loader-tpl' ).html() ),
     7536
     7537            model: {},
     7538
     7539            events: {
     7540                "click .forminator-addon-connect": "connect_addon",
     7541                "click .forminator-addon-disconnect" : "disconnect_addon",
     7542                "click .forminator-addon-form-disconnect" : "form_disconnect_addon",
     7543                "click .forminator-addon-next" : "submit_next_step",
     7544                "click .forminator-addon-back" : "go_prev_step",
     7545                "click .forminator-addon-finish" : "finish_steps"
     7546            },
     7547
     7548            initialize: function( options ) {
     7549                this.slug      = options.slug;
     7550                this.nonce     = options.nonce;
     7551                this.action    = options.action;
     7552                this.form_id   = options.form_id;
     7553                this.multi_id  = options.multi_id;
     7554                this.global_id = options.global_id;
     7555                this.step      = 0;
     7556                this.next_step = false;
     7557                this.prev_step = false;
     7558                this.scrollbar_width = this.get_scrollbar_width();
     7559
     7560                var self = this;
     7561
     7562                // Add closing event
     7563                this.$el.find( ".forminator-integration-close, .forminator-addon-close" ).on("click", function () {
     7564                    self.close(self);
     7565                });
     7566
     7567                return this.render();
     7568            },
     7569
     7570            render: function() {
     7571                var data = {};
     7572
     7573                data.action = this.action;
     7574                data._ajax_nonce = this.nonce;
     7575                data.data = {};
     7576                data.data.slug = this.slug;
     7577                data.data.step = this.step;
     7578                data.data.current_step = this.step;
     7579                data.data.global_id = this.global_id;
     7580                if (this.form_id) {
     7581                    data.data.form_id = this.form_id;
     7582                }
     7583                if (this.multi_id) {
     7584                    data.data.multi_id = this.multi_id;
     7585                }
     7586
     7587                this.request( data, false, true );
     7588            },
     7589
     7590            request: function ( data, close, loader ) {
     7591                var self            = this,
     7592                    function_params = {
     7593                        data  : data,
     7594                        close : close,
     7595                        loader: loader,
     7596                    };
     7597
     7598                if ( loader ) {
     7599                    this.$el.find(".forminator-integration-popup__header").html( '' );
     7600                    this.$el.find(".forminator-integration-popup__body").html( this.loaderTpl() );
     7601                    this.$el.find(".forminator-integration-popup__footer").html( '' );
     7602                }
     7603
     7604                this.$el.find(".sui-button:not(.disable-loader)").addClass("sui-button-onload");
     7605
     7606                this.ajax = $.post({
     7607                    url: Forminator.Data.ajaxUrl,
     7608                    type: 'post',
     7609                    data: data
     7610                })
     7611                .done(function (result) {
     7612                    if (result && result.success) {
     7613                        // Reset hidden elements.
     7614                        self.render_reset();
     7615
     7616                        // Render popup body
     7617                        self.render_body( result );
     7618
     7619                        // Render popup footer
     7620                        self.render_footer( result );
     7621
     7622                        // Hide elements when empty
     7623                        self.hide_elements();
     7624
     7625                        // Shorten result data
     7626                        var result_data = result.data.data;
     7627
     7628                        self.on_render( result_data );
     7629
     7630                        self.$el.find(".sui-button").removeClass("sui-button-onload");
     7631
     7632                        // Handle close modal
     7633                        if( close || ( !_.isUndefined( result_data.is_close ) && result_data.is_close ) ) {
     7634                            self.close( self );
     7635                        }
     7636
     7637                        // Add closing event
     7638                        self.$el.find( ".forminator-addon-close" ).on("click", function () {
     7639                            self.close(self);
     7640                        });
     7641
     7642                        // Handle notifications
     7643                        if( !_.isUndefined( result_data.notification ) &&
     7644                            !_.isUndefined( result_data.notification.type ) &&
     7645                            !_.isUndefined( result_data.notification.text ) ) {
     7646
     7647                            Forminator.Notification.open( result_data.notification.type, result_data.notification.text, 4000 );
     7648                        }
     7649
     7650                        // Handle back button
     7651                        if( !_.isUndefined( result_data.has_back ) ) {
     7652                            if( result_data.has_back ) {
     7653                                self.$el.find('.forminator-addon-back').show();
     7654                            } else {
     7655                                self.$el.find('.forminator-addon-back').hide();
     7656                            }
     7657                        } else {
     7658                            self.$el.find('.forminator-addon-back').hide();
     7659                        }
     7660
     7661                        if (result_data.is_poll) {
     7662                            setTimeout(self.request(function_params.data, function_params.close, function_params.loader), 5000);
     7663                        }
     7664
     7665                        //check the height
     7666                        var $popup_box = $( "#forminator-integration-popup .sui-box" ),
     7667                            $popup_box_height = $popup_box.height(),
     7668                            $window_height = $(window).height();
     7669
     7670                        // scrollbar appear
     7671                        if ($popup_box_height > $window_height) {
     7672                            // make scrollbar clickable
     7673                            $("#forminator-integration-popup .sui-dialog-overlay").css('right', self.scrollbar_width + 'px');
     7674                        } else {
     7675                            $("#forminator-integration-popup .sui-dialog-overlay").css('right', 0);
     7676                        }
     7677                    }
     7678                });
     7679
     7680                //remove the preloader
     7681                this.ajax.always(function () {
     7682                    self.$el.find(".fui-loading-dialog").remove();
     7683                });
     7684            },
     7685
     7686            render_reset: function() {
     7687                var integration_body = $( '.forminator-integration-popup__body' ),
     7688                    integration_footer = $( '.forminator-integration-popup__footer' );
     7689
     7690                // Show hidden body.
     7691                if ( integration_body.is( ':hidden' ) ) {
     7692                    integration_body.css( 'display', '' );
     7693                }
     7694
     7695                // Show empty footer.
     7696                if ( integration_footer.is( ':hidden' ) ) {
     7697                    integration_footer.css( 'display', '' );
     7698                }
     7699            },
     7700
     7701            render_body: function ( result ) {
     7702                // Render content inside `body`.
     7703                this.$el.find(".forminator-integration-popup__body").html( result.data.data.html );
     7704
     7705                // Append header elements to `sui-box-header`.
     7706                var integration_header = this.$el.find( '.forminator-integration-popup__body .forminator-integration-popup__header' ).remove();
     7707                if ( integration_header.length > 0 ) {
     7708                    this.$el.find( '.forminator-integration-popup__header' ).html( integration_header.html() );
     7709                }
     7710            },
     7711
     7712            render_footer: function ( result ) {
     7713                var self = this,
     7714                    buttons  = result.data.data.buttons
     7715                ;
     7716
     7717                // Clear footer from previous buttons
     7718                self.$el.find(".sui-box-footer").html('');
     7719
     7720                // Append footer elements from `body`.
     7721                var integration_footer = this.$el.find( '.forminator-integration-popup__body .forminator-integration-popup__footer-temp' ).remove();
     7722                if ( integration_footer.length > 0 ) {
     7723                    this.$el.find( '.forminator-integration-popup__footer' ).html( integration_footer.html() );
     7724                }
     7725
     7726                // Append buttons from php template.
     7727                _.each( buttons, function (button) {
     7728                    self.$el.find( '.sui-box-footer' ).append( button.markup );
     7729                });
     7730
     7731                // Align buttons.
     7732                self.$el.find( '.sui-box-footer' )
     7733                    .removeClass( 'sui-content-center' )
     7734                    .addClass( 'sui-content-separated' );
     7735
     7736                if ( self.$el.find( '.sui-box-footer' ).children( '.forminator-integration-popup__close' ).length > 0
     7737                        || buttons && 1 === Object.keys( buttons ).length
     7738                        ) {
     7739                    self.$el.find( '.sui-box-footer' )
     7740                        .removeClass( 'sui-content-separated' )
     7741                        .addClass( 'sui-content-center' );
     7742                }
     7743            },
     7744
     7745            hide_elements: function() {
     7746                var integration_body = $( '.forminator-integration-popup__body' ),
     7747                    integration_footer = $( '.forminator-integration-popup__footer' ),
     7748                    integration_content = integration_body.html(),
     7749                    integration_footer_html = integration_footer.html();
     7750
     7751                // Hide empty body.
     7752                if ( ! integration_content.trim().length ) {
     7753                    integration_body.hide();
     7754                }
     7755
     7756                // Hide empty footer.
     7757                if ( ! integration_footer_html.trim().length ) {
     7758                    integration_footer.hide();
     7759                }
     7760            },
     7761
     7762            on_render: function ( result ) {
     7763                this.delegateEvents();
     7764
     7765                // Delegate SUI events
     7766                Forminator.Utils.sui_delegate_events();
     7767                // multi select (Tags)
     7768                Forminator.Utils.forminator_select2_tags( this.$el, {} );
     7769
     7770                // Update current step
     7771                if( !_.isUndefined( result.forminator_addon_current_step ) ) {
     7772                    this.step = +result.forminator_addon_current_step;
     7773                }
     7774
     7775                // Update has next step
     7776                if( !_.isUndefined( result.forminator_addon_has_next_step ) ) {
     7777                    this.next_step = result.forminator_addon_has_next_step;
     7778                }
     7779
     7780                // Update has prev step
     7781                if( !_.isUndefined( result.forminator_addon_has_prev_step ) ) {
     7782                    this.prev_step = result.forminator_addon_has_prev_step;
     7783                }
     7784            },
     7785
     7786            get_step: function () {
     7787                if( this.next_step ) {
     7788                    return this.step + 1;
     7789                }
     7790
     7791                return this.step;
     7792            },
     7793
     7794            get_prev_step: function () {
     7795                if( this.prev_step ) {
     7796                    return this.step - 1;
     7797                }
     7798
     7799                return this.step;
     7800            },
     7801
     7802            connect_addon: function ( e ) {
     7803                var data     = {},
     7804                    form     = this.$el.find( 'form' ),
     7805                    params   = {
     7806                        'slug' : this.slug,
     7807                        'step' : this.get_step(),
     7808                        'global_id' : this.global_id,
     7809                        'current_step' : this.step,
     7810                    },
     7811                    formData = form.serialize()
     7812                ;
     7813
     7814                if (this.form_id) {
     7815                    params.form_id = this.form_id;
     7816                }
     7817                if (this.multi_id) {
     7818                    params.multi_id = this.multi_id;
     7819                }
     7820
     7821                formData = formData + '&' + $.param( params );
     7822                data.action = this.action;
     7823                data._ajax_nonce = this.nonce;
     7824                data.data = formData;
     7825
     7826                this.request( data, false, false );
     7827            },
     7828
     7829            submit_next_step: function(e) {
     7830                var data     = {},
     7831                    form     = this.$el.find( 'form' ),
     7832                    params   = {
     7833                        'slug' : this.slug,
     7834                        'step' : this.get_step(),
     7835                        'global_id' : this.global_id,
     7836                        'current_step' : this.step,
     7837                    },
     7838                    formData = form.serialize()
     7839                ;
     7840
     7841                if (this.form_id) {
     7842                    params.form_id = this.form_id;
     7843                }
     7844
     7845                formData = formData + '&' + $.param( params );
     7846                data.action = this.action;
     7847                data._ajax_nonce = this.nonce;
     7848                data.data = formData;
     7849
     7850                this.request( data, false, false );
     7851            },
     7852
     7853            go_prev_step: function(e) {
     7854                var data     = {},
     7855                    params   = {
     7856                        'slug' : this.slug,
     7857                        'step' : this.get_prev_step(),
     7858                        'global_id' : this.global_id,
     7859                        'current_step' : this.step,
     7860                    }
     7861                ;
     7862
     7863                if (this.form_id) {
     7864                    params.form_id = this.form_id;
     7865                }
     7866                if (this.multi_id) {
     7867                    params.multi_id = this.multi_id;
     7868                }
     7869
     7870                data.action = this.action;
     7871                data._ajax_nonce = this.nonce;
     7872                data.data = params;
     7873
     7874                this.request( data, false, false );
     7875            },
     7876
     7877            finish_steps: function ( e ) {
     7878                var data     = {},
     7879                    form     = this.$el.find( 'form' ),
     7880                    params   = {
     7881                        'slug' : this.slug,
     7882                        'step' : this.get_step(),
     7883                        'global_id' : this.global_id,
     7884                        'current_step' : this.step,
     7885                    },
     7886                    formData = form.serialize()
     7887                ;
     7888
     7889                if (this.form_id) {
     7890                    params.form_id = this.form_id;
     7891                }
     7892                if (this.multi_id) {
     7893                    params.multi_id = this.multi_id;
     7894                }
     7895
     7896                formData = formData + '&' + $.param( params );
     7897                data.action = this.action;
     7898                data._ajax_nonce = this.nonce;
     7899                data.data = formData;
     7900
     7901                this.request( data, false, false );
     7902            },
     7903
     7904            disconnect_addon: function ( e ) {
     7905                var data = {};
     7906                data.action = 'forminator_addon_deactivate';
     7907                data._ajax_nonce = this.nonce;
     7908                data.data = {};
     7909                data.data.slug = this.slug;
     7910                data.data.global_id = this.global_id;
     7911
     7912                this.request( data, true, false );
     7913            },
     7914
     7915            form_disconnect_addon: function ( e ) {
     7916                var data = {};
     7917                data.action = 'forminator_addon_deactivate_for_module';
     7918                data._ajax_nonce = this.nonce;
     7919                data.data = {};
     7920                data.data.slug = this.slug;
     7921                data.data.form_id = this.form_id;
     7922                data.data.form_type = 'form';
     7923                if (this.multi_id) {
     7924                    data.data.multi_id = this.multi_id;
     7925                }
     7926
     7927                this.request( data, true, false );
     7928            },
     7929
     7930            close: function( self ) {
     7931                // Kill AJAX hearbeat
     7932                self.ajax.abort();
     7933
     7934                // Remove the view
     7935                self.remove();
     7936
     7937                // Close the modal
     7938                Forminator.Integrations_Popup.close();
     7939
     7940                // Refrest add-on list
     7941                Forminator.Events.trigger( "forminator:addons:reload" );
     7942            },
     7943
     7944            get_scrollbar_width: function () {
     7945                //https://github.com/brandonaaron/jquery-getscrollbarwidth/
     7946                var scrollbar_width = 0;
     7947                if ( navigator.userAgent.match( "MSIE" ) ) {
     7948                    var $textarea1 = $('<textarea cols="10" rows="2"></textarea>')
     7949                            .css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body'),
     7950                        $textarea2 = $('<textarea cols="10" rows="2" style="overflow: hidden;"></textarea>')
     7951                            .css({ position: 'absolute', top: -1000, left: -1000 }).appendTo('body');
     7952                    scrollbar_width = $textarea1.width() - $textarea2.width();
     7953                    $textarea1.add($textarea2).remove();
     7954                } else {
     7955                    var $div = $('<div />')
     7956                        .css({ width: 100, height: 100, overflow: 'auto', position: 'absolute', top: -1000, left: -1000 })
     7957                        .prependTo('body').append('<div />').find('div')
     7958                        .css({ width: '100%', height: 200 });
     7959                    scrollbar_width = 100 - $div.width();
     7960                    $div.parent().remove();
     7961                }
     7962                return scrollbar_width;
     7963            }
     7964        });
     7965    });
     7966})(jQuery);
     7967
     7968(function ($) {
     7969    formintorjs.define('admin/addons/addons',[
     7970        'admin/addons/view'
     7971    ], function (SettingsView) {
     7972        var Addons = Backbone.View.extend({
     7973            el: '.sui-wrap.wpmudev-forminator-forminator-integrations',
     7974
     7975            currentTab: 'forminator-integrations',
     7976
     7977            events: {
     7978                "change .forminator-addon-toggle-enabled" : "toggle_state",
     7979                "click .connect-integration" : "connect_integration",
     7980                "click .forminator-integrations-wrapper .sui-vertical-tab a" : "go_to_tab",
     7981                "change .forminator-integrations-wrapper .sui-sidenav-hide-lg select" : "go_to_tab",
     7982                "change .forminator-integrations-wrapper .sui-sidenav-hide-lg.integration-nav" : "go_to_tab",
     7983                "keyup input.sui-form-control": "required_settings"
     7984            },
     7985
     7986            initialize: function( options ) {
     7987                if( $( this.el ).length > 0 ) {
     7988                    this.listenTo( Forminator.Events, "forminator:addons:reload", this.render_addons_page );
     7989                    return this.render();
     7990                }
     7991            },
     7992
     7993            render: function () {
     7994                // Check if addons wrapper exist
     7995                this.render_addons_page();
     7996
     7997                this.update_tab();
     7998            },
     7999
     8000            render_addons_page: function () {
     8001                var self = this,
     8002                    data = {}
     8003                ;
     8004
     8005                this.$el.find( '#forminator-integrations-display' ).html(
     8006                    '<div role="alert" id="forminator-addons-preloader" class="sui-notice sui-active" style="display: block;" aria-live="assertive">' +
     8007                        '<div class="sui-notice-content">' +
     8008                            '<div class="sui-notice-message">' +
     8009                                '<span class="sui-notice-icon sui-icon-loader sui-loading" aria-hidden="true"></span>' +
     8010                                '<p>Fetching integration list…</p>' +
     8011                            '</div>' +
     8012                        '</div>' +
     8013                    '</div>'
     8014                );
     8015
     8016                data.action      = 'forminator_addon_get_addons';
     8017                data._ajax_nonce = Forminator.Data.addonNonce;
     8018                data.data = {};
     8019
     8020                var ajax = $.post({
     8021                    url: Forminator.Data.ajaxUrl,
     8022                    type: 'post',
     8023                    data: data
     8024                })
     8025                .done(function (result) {
     8026                    if (result && result.success) {
     8027                        self.$el.find( '#forminator-integrations-page' ).html( result.data.data );
     8028                    }
     8029                });
     8030
     8031                //remove the preloader
     8032                ajax.always(function () {
     8033                    self.$el.find("#forminator-addons-preloader").remove();
     8034                });
     8035            },
     8036
     8037            connect_integration: function (e) {
     8038                e.preventDefault();
     8039
     8040                var $target = $(e.target);
     8041
     8042                if (!$target.hasClass('connect-integration')) {
     8043                    $target = $target.closest('.connect-integration');
     8044                }
     8045
     8046                var nonce    = $target.data('nonce'),
     8047                    slug     = $target.data('slug'),
     8048                    global_id= $target.data('multi-global-id'),
     8049                    title    = $target.data('title'),
     8050                    image    = $target.data('image'),
     8051                    image_x2 = $target.data('imagex2'),
     8052                    action   = $target.data('action'),
     8053                    form_id  = $target.data('form-id'),
     8054                    multi_id = $target.data('multi-id')
     8055                ;
     8056
     8057                Forminator.Integrations_Popup.open(function () {
     8058                    var view = new SettingsView({
     8059                        slug    : slug,
     8060                        nonce   : nonce,
     8061                        action  : action,
     8062                        form_id : form_id,
     8063                        multi_id : multi_id,
     8064                        global_id : global_id,
     8065                        el      : $(this)
     8066                    });
     8067                }, {
     8068                    title   : title,
     8069                    image   : image,
     8070                    image_x2: image_x2,
     8071                });
     8072            },
     8073
     8074            go_to_tab: function (e) {
     8075                e.preventDefault();
     8076                var target = $(e.target),
     8077                    href   = target.attr('href'),
     8078                    tab_id = '';
     8079                if (!_.isUndefined(href)) {
     8080                    tab_id = href.replace('#', '', href);
     8081                } else {
     8082                    var val = target.val();
     8083                    tab_id  = val;
     8084                }
     8085
     8086                if (!_.isEmpty(tab_id)) {
     8087                    this.currentTab = tab_id;
     8088                }
     8089
     8090                this.update_tab();
     8091
     8092                e.stopPropagation();
     8093            },
     8094
     8095            update_tab_select: function() {
     8096
     8097                if ( this.$el.hasClass( 'wpmudev-forminator-forminator-integrations' ) ) {
     8098                    this.$el.find('.sui-sidenav-hide-lg select').val(this.currentTab);
     8099                    this.$el.find('.sui-sidenav-hide-lg select').trigger('sui:change');
     8100                }
     8101            },
     8102
     8103            update_tab: function () {
     8104
     8105                if ( this.$el.hasClass( 'wpmudev-forminator-forminator-integrations' ) ) {
     8106
     8107                    this.clear_tabs();
     8108
     8109                    this.$el.find( '[data-tab-id=' + this.currentTab + ']' ).addClass( 'current' );
     8110                    this.$el.find( '.wpmudev-settings--box#' + this.currentTab ).show();
     8111                }
     8112            },
     8113
     8114            clear_tabs: function () {
     8115
     8116                if ( this.$el.hasClass( 'wpmudev-forminator-forminator-integrations' ) ) {
     8117                    this.$el.find( '.sui-vertical-tab ').removeClass( 'current' );
     8118                    this.$el.find( '.wpmudev-settings--box' ).hide();
     8119                }
     8120            },
     8121
     8122            required_settings: function( e ) {
     8123
     8124                var input = $( e.target ),
     8125                    field = input.parent(),
     8126                    error = field.find( '.sui-error-message' )
     8127                    ;
     8128
     8129                var tabWrapper = input.closest( 'div[data-nav]' ),
     8130                    tabFooter  = tabWrapper.find( '.sui-box-footer' ),
     8131                    saveButton = tabFooter.find( '.wpmudev-action-done' )
     8132                    ;
     8133
     8134                if ( this.$el.hasClass( 'wpmudev-forminator-forminator-settings' ) ) {
     8135
     8136                    if ( input.hasClass( 'forminator-required' ) && ! input.val() ) {
     8137
     8138                        if ( field.hasClass( 'sui-form-field' ) ) {
     8139                            field.addClass( 'sui-form-field-error' );
     8140                            error.show();
     8141                        }
     8142                    }
     8143
     8144                    if ( input.hasClass( 'forminator-required' ) && input.val() ) {
     8145
     8146                        if ( field.hasClass( 'sui-form-field' ) ) {
     8147                            field.removeClass( 'sui-form-field-error' );
     8148                            error.hide();
     8149                        }
     8150                    }
     8151
     8152                    if ( tabWrapper.find( 'input.sui-form-control' ).hasClass( 'forminator-required' ) ) {
     8153
     8154                        if ( tabWrapper.find( 'div.sui-form-field-error' ).length === 0 ) {
     8155                            saveButton.prop( 'disabled', false );
     8156                        } else {
     8157                            saveButton.prop( 'disabled', true );
     8158                        }
     8159                    }
     8160                }
     8161
     8162                e.stopPropagation();
     8163
     8164            },
     8165        });
     8166
     8167        //init after jquery ready
     8168        jQuery(function () {
     8169            new Addons();
     8170        });
     8171    });
     8172})(jQuery);
     8173
     8174(function ($) {
     8175    formintorjs.define('admin/addons-page',[
     8176    ], function() {
     8177        var AddonsPage = Backbone.View.extend({
     8178            el: '.wpmudev-forminator-forminator-addons',
     8179            events: {
     8180                "click button.addons-actions": "addons_actions",
     8181                "click a.addons-actions": "addons_actions",
     8182                "click .sui-dialog-close": "close",
     8183                "click .addons-modal-close": "close",
     8184                "click .addons-page-details": "open_addons_detail",
     8185            },
     8186            initialize: function () {
     8187                var self = this;
     8188                // only trigger on settings page
     8189                if (!$('.wpmudev-forminator-forminator-addons').length) {
     8190                    return;
     8191                }
     8192            },
     8193
     8194            addons_actions: function ( e ) {
     8195                var self = this,
     8196                    $target = $( e.target ),
     8197                    request_data = {},
     8198                    nonce = $target.data('nonce'),
     8199                    actions = $target.data('action'),
     8200                    popup = $target.data('popup'),
     8201                    is_network = $target.data('is_network'),
     8202                    pid = $target.data('addon');
     8203
     8204                if ( 'addons-connect' === actions ) {
     8205                    self.$el.find( ".ssm-session__button" ).trigger( 'click' );
     8206                    return false;
     8207                }
     8208
     8209                request_data.action = 'forminator_' + actions;
     8210                request_data.pid = pid;
     8211                request_data.is_network = is_network;
     8212                request_data._ajax_nonce = nonce;
     8213
     8214                $target.addClass("sui-button-onload");
     8215                self.$el.find(".sui-button.addons-actions:not(.disable-loader)")
     8216                    .attr( 'disabled', true );
     8217
     8218                $.post({
     8219                    url: Forminator.Data.ajaxUrl,
     8220                    type: 'post',
     8221                    data: request_data
     8222                }).done(function ( result ) {
     8223
     8224                    if ( 'undefined' !== typeof result.data.error ) {
     8225                        self.show_notification( result.data.error.message, 'error' );
     8226                        return false;
     8227                    }
     8228
     8229                    if ( 'addons-install' === actions ) {
     8230                        setTimeout(function () {
     8231                            self.active_popup( pid, 'show', 'forminator-activate-popup' );
     8232                            self.$el.find( '.sui-tab-content .addons-' + pid )
     8233                                .not( this )
     8234                                .replaceWith( result.data.html );
     8235                            self.loader_remove();
     8236                        }, 1000);
     8237
     8238                    } else {
     8239                        self.show_notification( result.data.message, 'success' );
     8240                        self.$el.find( '.sui-tab-content .addons-' + pid )
     8241                            .not( this )
     8242                            .replaceWith( result.data.html );
     8243
     8244                        if ( 'addons-update' === actions ) {
     8245
     8246                            var detailPopup = self.$el.find( '#forminator-modal-addons-details-' + pid );
     8247                            self.$el.find( '#updates-addons-content .addons-' + pid ).remove();
     8248
     8249                            var updateCounter = self.$el.find('#updates-addons-content .sui-col-md-6').length;
     8250                            if ( updateCounter < 1 ) {
     8251                                self.$el.find( '#updates-addons span.sui-tag').removeClass('sui-tag-yellow');
     8252                            }
     8253                            self.$el.find( '#updates-addons span.sui-tag').html( updateCounter );
     8254
     8255                            detailPopup.find( '.forminator-details-header--tags span.addons-update-tag').remove();
     8256
     8257                            var version = $target.data('version');
     8258                            detailPopup.find( '.forminator-details-header--tags span.addons-version').html( version );
     8259
     8260                            detailPopup.find( '.forminator-details-header button.addons-actions').remove();
     8261                            $target.remove();
     8262                        }
     8263                        if ( popup ) {
     8264                            location.reload();
     8265                        }
     8266                    }
     8267                }).fail( function () {
     8268                    self.show_notification( Forminator.l10n.commons.error_message, 'error' );
     8269                });
     8270
     8271                return false;
     8272            },
     8273
     8274            close: function( e ) {
     8275                e.preventDefault();
     8276
     8277                var $target = $( e.target ),
     8278                    pid = $target.data('addon'),
     8279                    element = $target.data('element');
     8280                this.active_popup( pid, 'hide', element );
     8281            },
     8282
     8283            loader_remove: function () {
     8284                this.$el.find(".sui-button.addons-actions:not(.disable-loader)")
     8285                    .removeClass("sui-button-onload")
     8286                    .attr( 'disabled', false );
     8287            },
     8288
     8289            show_notification: function ( message, status ) {
     8290                var error_message = 'undefined' !== typeof message
     8291                    ? message :
     8292                    Forminator.l10n.commons.error_message;
     8293                Forminator.Notification.open( status, error_message, 4000 );
     8294                this.loader_remove();
     8295            },
     8296
     8297            active_popup: function ( pid, status, element ) {
     8298                var modalId = element + '-' + pid,
     8299                    focusAfterClosed = 'forminator-addon-' + pid + '__card';
     8300
     8301                if ( 'show' === status ) {
     8302                    SUI.openModal(
     8303                        modalId,
     8304                        focusAfterClosed
     8305                    );
     8306                } else {
     8307                    SUI.closeModal();
     8308                }
     8309            },
     8310
     8311            open_addons_detail: function ( e ) {
     8312                var self = this,
     8313                    $target = $( e.target ),
     8314                    pid = $target.data('form-id');
     8315                self.active_popup( pid, 'show', 'forminator-modal-addons-details' );
     8316            }
     8317        });
     8318
     8319        var AddonsPage = new AddonsPage();
     8320
     8321        return AddonsPage;
     8322    });
     8323})(jQuery);
     8324
     8325(function ($) {
     8326    formintorjs.define('admin/reports-page',[
     8327    ], function() {
     8328        var ReportsPage = Backbone.View.extend({
     8329            el: '.wpmudev-forminator-forminator-reports',
     8330            events: {
     8331                'click .sui-side-tabs label.sui-tab-item input': 'sidetabs',
     8332                "click .sui-sidenav .sui-vertical-tab a": "sidenav",
     8333                "change .sui-sidenav select.sui-mobile-nav": "sidenav_select",
     8334                "apply.daterangepicker input.forminator-reports-filter-date": "filter_report_date",
     8335                "click #forminator-checked-all-reports": "check_all",
     8336                "change label input.notification-status": "change_report_status",
     8337                "change label input.report-checkbox": "change_report_check",
     8338            },
     8339            initialize: function () {
     8340                var self = this;
     8341                // only trigger on reports page
     8342                if (!$('.wpmudev-forminator-forminator-reports').length) {
     8343                    return;
     8344                }
     8345                self.render_daterange();
     8346
     8347                self.chartJs = self.forminator_reports_chart( window.monthDays, window.submissions, window.canvas_spacing );
     8348            },
     8349
     8350            render_daterange: function () {
     8351                var default_start_date = moment().startOf('month'),
     8352                    default_end_date = moment().endOf('month');
     8353                $('input.forminator-reports-filter-date').daterangepicker({
     8354                    autoUpdateInput: false,
     8355                    autoApply: true,
     8356                    alwaysShowCalendars: true,
     8357                    ranges: window.forminator_reports_datepicker_ranges,
     8358                    locale: forminatorl10n.daterangepicker,
     8359                    startDate: default_start_date,
     8360                    endDate: default_end_date,
     8361                    showCustomRangeLabel: false
     8362                }).val( default_start_date.format( 'MMMM DD, YYYY' ) + ' - ' + default_end_date.format( 'MMMM DD, YYYY' ) );
     8363            },
     8364
     8365            filter_report_date: function ( e, picker ) {
     8366                var self = this,
     8367                    $target = $( e.target ),
     8368                    startDate = picker.startDate,
     8369                    endDate = picker.endDate,
     8370                    form_id = self.$el.find('#forminator-reports select[name=form_id]').val(),
     8371                    form_type = self.$el.find('#forminator-reports select[name=form_type]').val(),
     8372                    date_range_text = startDate.format( 'MMMM DD, YYYY' ) + ' - ' + endDate.format( 'MMMM DD, YYYY' );
     8373
     8374                self.add_report_loader();
     8375                $target.val( date_range_text );
     8376                self.$el.find('.forminator-chart-date').html( forminatorl10n.popup.showing_report_from + ' ' + date_range_text );
     8377                $.post({
     8378                    url: Forminator.Data.ajaxUrl,
     8379                    type: 'post',
     8380                    data: {
     8381                        action: 'forminator_filter_report_data',
     8382                        form_id: form_id,
     8383                        form_type: form_type,
     8384                        _ajax_nonce: $target.data('nonce'),
     8385                        start_date: startDate.format( 'YYYY-MM-DD' ),
     8386                        end_date: endDate.format( 'YYYY-MM-DD' ),
     8387                        range_time: picker.chosenLabel
     8388                    },
     8389                }).done(function ( result ) {
     8390                    if ( result.data ) {
     8391                        var result_data = result.data,
     8392                            reports_data = result_data.reports,
     8393                            chart_data = result_data.chart_data,
     8394                            app_table_container = self.$el.find('.fui-table--apps'),
     8395                            report_container = self.$el.find('#forminator-reports');
     8396                        $.each( reports_data, function (result_key, result_value) {
     8397                            var result_key_class = self.$el.find('.increment-' + result_key);
     8398                            result_key_class.html('');
     8399                            if ( result_value.selected > 0 || 0 !== result_value.selected ) {
     8400                                var arrow_color = 'high' === result_value.difference ? 'fui-trend-green' : 'fui-trend-red',
     8401                                arrow_icon = 'high' === result_value.difference ? 'sui-icon-arrow-up' : 'sui-icon-arrow-down',
     8402                                increment_html = '<i class="' + arrow_icon + ' sui-sm" aria-hidden="true"></i>';
     8403                                result_key_class.html( increment_html + result_value.increment );
     8404                                result_key_class.removeClass('fui-trend-green')
     8405                                    .removeClass('fui-trend-red')
     8406                                    .addClass( arrow_color );
     8407                            }
     8408                            report_container.find('.selected-' + result_key).html( result_value.selected );
     8409                            report_container.find('.previous-' + result_key).html( result_value.previous );
     8410                            if ( 'undefined' !== typeof result_value.average ) {
     8411                                report_container.find('.average-' + result_key).html(result_value.average);
     8412                            }
     8413                            if ( 'undefined' !== typeof result_value.stripe ) {
     8414                                report_container.find('.stripe-report').html(result_value.stripe);
     8415                            }
     8416                            if ( 'undefined' !== typeof result_value.paypal ) {
     8417                                report_container.find('.paypal-report').html(result_value.paypal);
     8418                            }
     8419                            self.$el.find('.forminator-reports-chart li.chart-' + result_key + ' span').html( result_value.selected );
     8420                            if ( 'integration' === result_key ) {
     8421                                $.each( result_value, function (key, value) {
     8422                                    var app_increment_container = app_table_container.find('.increment-' + key);
     8423                                    app_increment_container.html('');
     8424                                    if ( value.selected > 0 ) {
     8425                                        var app_arrow_color = 'high' === value.difference ? 'fui-trend-green' : 'fui-trend-red',
     8426                                            app_arrow_icon = 'high' === value.difference ? 'sui-icon-arrow-up' : 'sui-icon-arrow-down',
     8427                                            increment_html = '<i class="' + app_arrow_icon + ' sui-sm" aria-hidden="true"></i>';
     8428                                        app_increment_container.html( increment_html + value.increment );
     8429                                        app_increment_container.removeClass('fui-trend-green')
     8430                                            .removeClass('fui-trend-red')
     8431                                            .addClass( app_arrow_color );
     8432                                    }
     8433                                    app_table_container.find('.selected-' + key).html( value.selected );
     8434                                    app_table_container.find('.previous-' + key).html( value.previous );
     8435                                });
     8436                            }
     8437                        });
     8438                        var chartMonth = chart_data.monthDays,
     8439                            chartSubmissions = chart_data.submissions,
     8440                            canvas_spacing = chart_data.canvas_spacing;
     8441
     8442                        if ( result_data.geolocation ) {
     8443                            self.$el.find('#forminator_report_geolocation_widget .forminator-report-widget-content').html( result_data.geolocation );
     8444                            // Rebind Accordion scripts
     8445                            SUI.suiAccordion( $( '.sui-accordion' ) );
     8446                        }
     8447                        setTimeout(function () {
     8448                            self.remove_report_loader( reports_data.entries.selected );
     8449                            self.add_chart_data( self.chartJs, chartMonth, chartSubmissions, canvas_spacing );
     8450                        }, 1000);
     8451                    }
     8452
     8453                }).fail( function () {
     8454                    self.remove_report_loader();
     8455                });
     8456            },
     8457
     8458            add_report_loader: function () {
     8459                this.$el.find('.forminator-reports-box .sui-box').addClass('sui-box__onload');
     8460                this.$el.find('.forminator-reports-chart ul.sui-accordion-item-data').addClass('sui-onload');
     8461                this.$el.find('.forminator-reports-chart .sui-chartjs').removeClass('sui-chartjs-loaded');
     8462                this.$el.find('.sui-chartjs-message--empty').show();
     8463            },
     8464
     8465            remove_report_loader: function ( entries ) {
     8466                this.$el.find('.forminator-reports-box .sui-box').removeClass('sui-box__onload');
     8467                this.$el.find('.forminator-reports-chart ul.sui-accordion-item-data').removeClass('sui-onload');
     8468                this.$el.find('.forminator-reports-chart .sui-chartjs').addClass('sui-chartjs-loaded');
     8469                if ( 0 < entries ) {
     8470                    this.$el.find('.sui-chartjs-message--empty').hide();
     8471                }
     8472            },
     8473           
     8474            add_chart_data: function ( chart, label, data, max ) {
     8475                if ( 'undefined' !== typeof chart ) {
     8476                    chart.data.labels = label;
     8477                    chart.data.datasets[0].data = data;
     8478                    chart.options.scales.yAxes[0].ticks.max = max;
     8479                    chart.update();
     8480                }
     8481            },
     8482
     8483            forminator_reports_chart: function ( monthDays, submissions, canvas_max ) {
     8484                var ctx = document.getElementById('forminator-module-' + window.chart_form_id + '-stats');
     8485                var chartData = {
     8486                    labels: monthDays,
     8487                    datasets: [{
     8488                        label: window.chart_label,
     8489                        data: submissions,
     8490                        backgroundColor: [
     8491                            '#E1F6FF'
     8492                        ],
     8493                        borderColor: [
     8494                            '#17A8E3'
     8495                        ],
     8496                        borderWidth: 2,
     8497                        pointRadius: 0,
     8498                        pointHitRadius: 20,
     8499                        pointHoverRadius: 5,
     8500                        pointHoverBorderColor: '#17A8E3',
     8501                        pointHoverBackgroundColor: '#17A8E3'
     8502                    }]
     8503                };
     8504                var chartOptions = {
     8505                    maintainAspectRatio: false,
     8506                    legend: {
     8507                        display: false
     8508                    },
     8509                    scales: {
     8510                        xAxes: [{
     8511                            display: false,
     8512                            gridLines: {
     8513                                color: 'rgba(0, 0, 0, 0)'
     8514                            }
     8515                        }],
     8516                        yAxes: [{
     8517                            display: false,
     8518                            gridLines: {
     8519                                color: 'rgba(0, 0, 0, 0)'
     8520                            },
     8521                            ticks: {
     8522                                beginAtZero: false,
     8523                                min: 0,
     8524                                max: canvas_max,
     8525                                stepSize: 1
     8526                            }
     8527                        }]
     8528                    },
     8529                    elements: {
     8530                        line: {
     8531                            tension: 0
     8532                        },
     8533                        point: {
     8534                            radius: 0
     8535                        }
     8536                    },
     8537                    tooltips: {
     8538                        custom: function (tooltip) {
     8539                            if (!tooltip) return;
     8540                            // disable displaying the color box;.
     8541                            tooltip.displayColors = false;
     8542                        },
     8543                        callbacks: {
     8544                            title: function (tooltipItem, data) {
     8545                                return tooltipItem[0].yLabel + " " + window.chart_label;
     8546                            },
     8547                            label: function (tooltipItem, data) {
     8548                                return tooltipItem.xLabel;
     8549                            },
     8550                            // Set label text color.
     8551                            labelTextColor: function (tooltipItem, chart) {
     8552                                return '#AAAAAA';
     8553                            }
     8554                        }
     8555                    },
     8556                    plugins: {
     8557                        datalabels: {
     8558                            display: false
     8559                        }
     8560                    }
     8561                };
     8562
     8563                if (ctx) {
     8564                    var reportChart = new Chart(ctx, {
     8565                        type: 'line',
     8566                        fill: 'start',
     8567                        data: chartData,
     8568                        plugins: [
     8569                            ChartDataLabels
     8570                        ],
     8571                        options: chartOptions
     8572                    });
     8573                }
     8574
     8575                return reportChart;
     8576            },
     8577
     8578            sidetabs: function( e ) {
     8579                var $this      = this.$( e.target ),
     8580                    $label     = $this.parent( 'label' ),
     8581                    $data      = $this.data( 'tab-menu' ),
     8582                    $wrapper   = $this.closest( '.sui-side-tabs' ),
     8583                    $alllabels = $wrapper.find( '.sui-tabs-menu .sui-tab-item' ),
     8584                    $allinputs = $alllabels.find( 'input' )
     8585                ;
     8586
     8587                if ( $this.is( 'input' ) ) {
     8588
     8589                    $alllabels.removeClass( 'active' );
     8590                    $allinputs.removeAttr( 'checked' );
     8591                    $wrapper.find( '.sui-tabs-content > div' ).removeClass( 'active' );
     8592
     8593                    $label.addClass( 'active' );
     8594                    $this.prop( 'checked', 'checked' );
     8595
     8596                    if ( $wrapper.find( '.sui-tabs-content div[data-tab-content="' + $data + '"]' ).length ) {
     8597                        $wrapper.find( '.sui-tabs-content div[data-tab-content="' + $data + '"]' ).addClass( 'active' );
     8598                    }
     8599                }
     8600            },
     8601
     8602            sidenav: function( e ) {
     8603                var tab_name = $( e.target ).data( 'nav' );
     8604                if ( tab_name ) {
     8605                    this.sidenav_go_to( tab_name, true );
     8606                }
     8607                e.preventDefault();
     8608
     8609            },
     8610
     8611            sidenav_select: function( e ) {
     8612                var tab_name = $(e.target).val();
     8613                if ( tab_name ) {
     8614                    this.sidenav_go_to( tab_name, true );
     8615                }
     8616                e.preventDefault();
     8617
     8618            },
     8619
     8620            sidenav_go_to: function( tab_name, update_history ) {
     8621
     8622                var $tab     = this.$el.find( 'a[data-nav="' + tab_name + '"]' ),
     8623                    $sidenav = $tab.closest( '.sui-vertical-tabs' ),
     8624                    $tabs    = $sidenav.find( '.sui-vertical-tab' ),
     8625                    $content = this.$el.find( '.sui-box-reports[data-nav]' ),
     8626                    $current = this.$el.find( '.sui-box-reports[data-nav="' + tab_name + '"]' );
     8627
     8628                if ( update_history ) {
     8629                    var tab_url = 'admin.php?page=forminator-reports&section=' + tab_name;
     8630                    if ( 'dashboard' === tab_name ) {
     8631                        var form_id = this.$el.find('#forminator-reports select[name=form_id]').val(),
     8632                            form_type = this.$el.find('#forminator-reports select[name=form_type]').val();
     8633                        if ( '' !== form_id && '' !== form_type ){
     8634                            tab_url = 'admin.php?page=forminator-reports&form_type=' + form_type + '&form_id=' + form_id;
     8635                        }
     8636                    }
     8637                    history.pushState( { selected_tab: tab_name }, 'Reports', tab_url );
     8638                }
     8639
     8640                $tabs.removeClass( 'current' );
     8641                $content.hide();
     8642
     8643                $tab.parent().addClass( 'current' );
     8644                $current.show();
     8645            },
     8646
     8647            check_all: function ( e ) {
     8648                var $this = this.$( e.target ),
     8649                    $checked = $this.is(':checked'),
     8650                    $table = $this.closest('table');
     8651                $table.find( ".sui-checkbox input" ).each( function () {
     8652                    this.checked = $checked;
     8653                });
     8654                if ($('form[name="report-bulk-action"] input[name="ids"]').length) {
     8655                    var ids = $('#forminator-reports-list').find('.sui-checkbox input[id|="report"]:checked').map(function () {
     8656                            if (parseFloat(this.value)) return this.value;
     8657                        }
     8658                    ).get().join(',');
     8659                    $('form[name="report-bulk-action"] input[name="ids"]').val(ids);
     8660                }
     8661            },
     8662            change_report_status: function ( e ) {
     8663                var status = e.target.checked ? 'active' : 'inactive',
     8664                    report_id = $(e.target).val();
     8665                $.ajax({
     8666                    url: Forminator.Data.ajaxUrl,
     8667                    type: "POST",
     8668                    data: {
     8669                        'action': 'forminator_report_update_status',
     8670                        'nonce': forminatorl10n.popup.save_nonce,
     8671                        'report_id': report_id,
     8672                        'status': status
     8673                    },
     8674                    success: function( response ) {
     8675                        var tooltip = e.target.checked ? forminatorl10n.popup.deactivate_report : forminatorl10n.popup.activate_report;
     8676                        $('.report-status-tooltip').attr( 'data-tooltip', tooltip );
     8677                    },
     8678                });
     8679            },
     8680
     8681            change_report_check: function () {
     8682                if ( $( 'form[name="report-bulk-action"] input[name="ids"]' ).length ) {
     8683                    var ids = $( ".sui-checkbox input.report-checkbox:checked" ).map( function()
     8684                    { if ( parseFloat( this.value ) ) return this.value; } ).get().join( ',' );
     8685                    $( 'form[name="report-bulk-action"] input[name="ids"]' ).val( ids );
     8686                }
     8687                if( $(this).attr('id') !== 'forminator-checked-all-reports') {
     8688                    $('#forminator-checked-all-reports').prop("checked", false);
     8689                }
     8690            }
     8691
     8692        });
     8693
     8694        var ReportsPage = new ReportsPage();
     8695
     8696        return ReportsPage;
     8697    });
     8698})(jQuery);
     8699
     8700(function ($) {
     8701    formintorjs.define('admin/views',[
     8702        'admin/dashboard',
     8703        'admin/settings-page',
     8704        'admin/popups',
     8705        'admin/addons/addons',
     8706        'admin/addons-page',
     8707        'admin/reports-page',
     8708    ], function( Dashboard, SettingsPage, Popups, Addons, AddonsPage, ReportsPage ) {
     8709        return {
     8710            "Views": {
     8711                "Dashboard": Dashboard,
     8712                "SettingsPage": SettingsPage,
     8713                "Popups": Popups,
     8714                "AddonsPage": AddonsPage,
     8715                "ReportsPage": ReportsPage,
     8716            }
     8717        }
     8718    });
     8719})(jQuery);
     8720
     8721(function ($) {
     8722    formintorjs.define('admin/application',[
     8723        'admin/views',
     8724    ], function ( Views )  {
     8725        _.extend(Forminator, Views);
     8726
     8727        var Application = new ( Backbone.Router.extend({
     8728            app: false,
     8729            data: false,
     8730            layout: false,
     8731            module_id: null,
     8732
     8733            routes: {
     8734                ""              : "run",
     8735                "*path"         : "run"
     8736            },
     8737
     8738            events: {},
     8739
     8740            init: function () {
     8741                // Load Forminator Data only first time
     8742                if( ! this.data ) {
     8743                    this.app = Forminator.Data.application || false;
     8744
     8745                    // Retrieve current data
     8746                    this.data = {};
     8747
     8748                    return false;
     8749                }
     8750            },
     8751
     8752            run: function (id) {
     8753
     8754                this.init();
     8755
     8756                this.module_id = id;
     8757            },
     8758        }));
     8759
     8760        return Application;
     8761    });
     8762
     8763})(jQuery);
     8764
     8765formintorjs.define( 'jquery', [], function () {
     8766    return jQuery;
     8767});
     8768
     8769formintorjs.define( 'forminator_global_data', function() {
     8770   var data = forminatorData;
     8771    return data;
     8772});
     8773
     8774formintorjs.define( 'forminator_language', function() {
     8775   var l10n = forminatorl10n;
     8776    return l10n;
     8777});
     8778
     8779var Forminator = window.Forminator || {};
     8780Forminator.Events = {};
     8781Forminator.Data = {};
     8782Forminator.l10n = {};
     8783Forminator.openPreset = function( presetId, notice ) {
     8784    // replace preset param to the new one.
     8785    var regEx = /([?&]preset)=([^&]*)/g,
     8786        newUrl = window.location.href.replace( regEx, '$1=' + presetId );
     8787
     8788    // if it didn't have preset param - add it.
     8789    if ( newUrl === window.location.href ) {
     8790        newUrl += '&preset=' + presetId;
     8791    }
     8792
     8793    if ( notice ) {
     8794        newUrl += '&forminator_notice=' + notice;
     8795    }
     8796
     8797    window.location.href = newUrl;
     8798};
     8799
     8800formintorjs.require.config({
     8801    baseUrl: ".",
     8802    paths: {
     8803        "js": ".",
     8804        "admin": "admin",
     8805    },
     8806    shim: {
     8807        'backbone': {
     8808            //These script dependencies should be loaded before loading
     8809            //backbone.js
     8810            deps: [ 'underscore', 'jquery', 'forminator_global_data', 'forminator_language' ],
     8811            //Once loaded, use the global 'Backbone' as the
     8812            //module value.
     8813            exports: 'Backbone'
     8814        },
     8815        'underscore': {
     8816            exports: '_'
     8817        }
     8818    },
     8819    "waitSeconds": 60,
     8820});
     8821
     8822formintorjs.require([  'admin/utils' ], function ( Utils ) {
     8823    // Fix Underscore templating to Mustache style
     8824    _.templateSettings = {
     8825        evaluate : /\{\[([\s\S]+?)\]\}/g,
     8826        interpolate : /\{\{([\s\S]+?)\}\}/g
     8827    };
     8828
     8829    _.extend( Forminator.Data, forminatorData );
     8830    _.extend( Forminator.l10n, forminatorl10n );
     8831    _.extend( Forminator, Utils );
     8832    _.extend(Forminator.Events, Backbone.Events);
     8833
     8834    formintorjs.require([ 'admin/application' ], function ( Application ) {
     8835        jQuery( function() {
     8836            _.extend(Forminator, Application);
     8837
     8838            Forminator.Events.trigger("application:booted");
     8839            Backbone.history.start();
     8840        });
     8841    });
     8842});
     8843
     8844formintorjs.define("admin/setup", function(){});
     8845
     8846
     8847formintorjs.define("main", function(){});
Note: See TracChangeset for help on using the changeset viewer.